v0.0.14: Improve SSR support and fix race condition

Addresses critical issues identified in code review:

1. Server-Side Environment Handling:
   - Add warning when serverURL is not provided in SSR/SSG environments
   - Falls back to relative URLs with console warning
   - Prevents silent failures in server-side rendering

2. Race Condition Fix:
   - Use useRef for initialFlags to prevent re-creating fetchFlags on every render
   - Removes initialFlags from useCallback dependencies
   - Prevents excessive re-renders and potential infinite loops

These improvements ensure better stability and reliability in both
client-side and server-side environments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 18:30:58 +02:00
parent 4f802c8cc9
commit 9bb5f4ecc8
2 changed files with 25 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@xtr-dev/payload-feature-flags",
"version": "0.0.13",
"version": "0.0.14",
"description": "Feature flags plugin for Payload CMS - manage feature toggles, A/B tests, and gradual rollouts",
"license": "MIT",
"type": "module",