You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0809be2
Browse filesBrowse the repository at this point in the historyBrowse files
Keep published evaluator 2.0.0 and main's dependency updates, port ETag revalidation and initialization diagnostics to complete collections, preserve application-owned shutdown, and address the three Node migration review regressions. Keep OpenFeature and the v1 bootstrap demo isolated on published Node 1.8.3.
Copy file name to clipboardExpand all lines: packages/browser-sdk/CHANGELOG.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,29 @@
1
1
# @reflag/browser-sdk
2
2
3
+
## 1.7.4
4
+
5
+
### Patch Changes
6
+
7
+
- 0840683: Avoid reporting `CLIENT_NOT_INITIALIZED` when a flag is evaluated from the initial flag state while client initialization is completing.
8
+
9
+
## 1.7.3
10
+
11
+
### Patch Changes
12
+
13
+
- e8a0e10: Unsubscribe toolbar flag listeners when the toolbar is unmounted or switches clients.
14
+
15
+
## 1.7.2
16
+
17
+
### Patch Changes
18
+
19
+
- 4649418: Preserve the response body returned by `setOptIn()` on HTTP errors so callers can read error details. Clarify opt-in loading, retry, and mutation result handling in the SDK documentation.
20
+
21
+
## 1.7.1
22
+
23
+
### Patch Changes
24
+
25
+
- df37a58: Include non-fatal flag evaluation diagnostics in check events sent by the Node, browser, React, and Vue SDKs, including when flags are evaluated before client initialization.
optedIn: true, // Use false to cancel this scope's opt-in.
220
+
scope: "user", // Use "company" to change the current company's opt-in.
221
+
});
222
+
if (!response?.ok) {
223
+
console.error("Could not update opt-in");
224
+
}
225
+
} catch (error) {
226
+
console.error("Could not update opt-in", error);
227
+
}
225
228
```
226
229
227
230
By default, `setOptIn()` changes the opt-in for the current user, so the current context must include a `user.id`. To manage the current company's opt-in instead, pass `scope: "company"`; the context must then include a `company.id`.
228
231
229
232
User and company opt-ins are managed independently. Setting `optedIn` to `false` removes the opt-in only for the selected scope. For example, cancelling a user's opt-in does not change the company's opt-in for the same flag.
230
233
231
-
`setOptIn` returns a promise so you can wait for the new membership state to be synchronized. It resolves after the latest flag state has been applied locally, the requested membership change has been confirmed, and `flagsUpdated` listeners have been notified.
234
+
`setOptIn` returns a promise so you can wait for the new membership state to be synchronized. On success, it resolves after the refreshed flag state has been applied locally, the requested membership change has been confirmed, and `flagsUpdated` listeners have been notified when flags change.
235
+
236
+
The promise resolves to a `Response`, or `undefined` if skipped due to invalid input, offline mode etc. Check `response?.ok` for success.
232
237
233
238
The `description` comes from the dedicated SDK-facing opt-in description configured in Reflag.
234
239
235
-
For a bootstrapped client, the first `getOptInFlags()` or `getIsLoadingOptInFlags()` call starts one flags refresh. The list call returns the currently available list synchronously, and the loading getter returns `true` until the refresh succeeds or fails. Normal initialization already exposes loading through the client's state.
240
+
When using bootstrapped flags, the first `getOptInFlags()` or `getIsLoadingOptInFlags()` call requests a flags refresh. The list call returns the currently available list synchronously, and the loading getter returns `true` until that refresh succeeds or fails. Normal initialization also exposes loading through the client's state.
236
241
237
242
Listen for `optInFlagsLoadingUpdated` to update UI when this loading state changes. `flagsUpdated` is emitted when a successful refresh updates the list.
238
243
244
+
If fetching opt-in metadata fails, loading ends without exposing an error. Call `reflagClient.refresh()` to retry.
245
+
239
246
## Remote config
240
247
241
248
Remote config is a dynamic and flexible approach to configuring flag behavior outside of your app – without needing to re-deploy it.
@@ -358,6 +365,8 @@ const client = new ReflagClient({
358
365
359
366
> [!NOTE]
360
367
> After bootstrapping, any live flag updates are fetched directly by the browser SDK from Reflag using the browser-visible context. If your bootstrapped snapshot depends on server-only or secret context that is not available in the browser, later live refreshes may differ. In that case, keep `enableLiveFlagUpdates` disabled.
368
+
>
369
+
> Requesting opt-in flags also triggers a browser-side refresh, even when `enableLiveFlagUpdates` is disabled.
361
370
362
371
This eliminates loading states and removes the initial render's dependency on the flags API.
0 commit comments