|
1 | 1 | # @reflag/react-native-sdk |
2 | 2 |
|
| 3 | +## 0.2.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 55bebb4: Add live flag updates to the client-facing SDKs. |
| 8 | + |
| 9 | + The browser SDK now supports `enableLiveFlagUpdates`, which subscribes to Reflag's SSE endpoint and refreshes flags automatically when they change. The browser SDK keeps this disabled by default, while the React, React Native, and Vue SDKs enable it by default. |
| 10 | + |
| 11 | + The Node SDK's `getFlagsForBootstrap()` output now includes `flagStateVersion` when the Node SDK has received a flag-state version from Reflag: |
| 12 | + |
| 13 | + ```ts |
| 14 | + type BootstrappedState = { |
| 15 | + context: ReflagContext; |
| 16 | + flags: RawFlags; |
| 17 | + flagStateVersion?: number; |
| 18 | + }; |
| 19 | + ``` |
| 20 | + |
| 21 | + `flagStateVersion` lets bootstrapped clients avoid redundant refreshes immediately after hydration, ignore stale bootstrapped payloads, and request the newest flag state after a live update. |
| 22 | + |
| 23 | + The browser SDK accepts this object through `bootstrappedState`. React, React Native, and Vue keep their existing `flags` prop on bootstrapped providers, and that prop now accepts the same full object: |
| 24 | + |
| 25 | + ```tsx |
| 26 | + const bootstrappedState = serverClient.getFlagsForBootstrap(context); |
| 27 | + |
| 28 | + const client = new ReflagClient({ |
| 29 | + publishableKey, |
| 30 | + bootstrappedState, |
| 31 | + }); |
| 32 | + |
| 33 | + <ReflagBootstrappedProvider |
| 34 | + publishableKey={publishableKey} |
| 35 | + flags={bootstrappedState} |
| 36 | + > |
| 37 | + {children} |
| 38 | + </ReflagBootstrappedProvider>; |
| 39 | + ``` |
| 40 | + |
| 41 | + This is backwards compatible for initial rendering: existing bootstrapped payloads shaped as `{ context, flags }` still initialize the SDK, and the React, React Native, and Vue provider prop name has not changed. Live flag updates after bootstrapping require `flagStateVersion`; if it is missing, the client will warn and disable live updates for that client. |
| 42 | + |
| 43 | + Browser-facing SDKs now use `apiBaseUrl` for SSE by default, which points to `https://front.reflag.com` unless overridden. Live flag updates and feedback notifications now share `https://front.reflag.com`, so default CSP setups only need to allow `connect-src https://front.reflag.com` instead of `https://livemessaging.bucket.co`. `sseBaseUrl` remains available as an override if you need a separate SSE host. |
| 44 | + |
| 45 | + The Node SDK now uses Reflag's server push SSE endpoint (`GET https://front.reflag.com/sse/server`) for live flag definition updates instead of `https://pubsub.reflag.com`. If you override `flagsPushUrl`, the SDK will open that URL with the same authenticated streaming GET behavior. |
| 46 | + |
| 47 | +### Patch Changes |
| 48 | + |
| 49 | +- Updated dependencies [55bebb4] |
| 50 | + - @reflag/react-sdk@1.5.0 |
| 51 | + |
3 | 52 | ## 0.1.5 |
4 | 53 |
|
5 | 54 | ### Patch Changes |
|
0 commit comments