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
Copy file name to clipboardExpand all lines: CHANGES.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
2.1.1 (April 8, 2025)
2
-
- Bugfix - Fixed `useSplitClient` and `useSplitTreatments` hooks to properly respect `updateOn<Event>` options. Previously, if the hooks were re-called due to a component re-render, they used the latest version of the SDK client status ignoring when `updateOn<Event>` options were set to `false` and resulting in unexpected changes in treatment values.
2
+
- Bugfixing - Fixed `useSplitClient` and `useSplitTreatments` hooks to properly respect `updateOn<Event>` options. Previously, if the hooks were re-called due to a component re-render, they used the latest version of the SDK client status ignoring when `updateOn<Event>` options were set to `false` and resulting in unexpected changes in treatment values.
3
3
4
4
2.1.0 (March 28, 2025)
5
5
- Added a new optional `properties` argument to the options object of the `useSplitTreatments` hook, allowing to pass a map of properties to append to the generated impressions sent to Split backend. Read more in our docs.
act(()=>mainClient.__emitter__.emit(Event.SDK_UPDATE));// do not trigger re-render because updateOnSdkUpdate is false now
261
+
act(()=>mainClient.__emitter__.emit(Event.SDK_UPDATE));// do not trigger re-render because updateOnSdkUpdate is false
259
262
expect(rendersCount).toBe(5);
263
+
264
+
wrapper.rerender(<ComponentupdateOnSdkUpdate={false}updateOnSdkTimedout={false}/>);// should not update the status (SDK_UPDATE event should be ignored)
265
+
expect(rendersCount).toBe(6);
266
+
expect(currentStatus).toEqual(previousStatus);
267
+
268
+
wrapper.rerender(<ComponentupdateOnSdkUpdate={null/** invalid type should default to `true` */}/>);// trigger re-render and update the status because updateOnSdkUpdate is true and there was an SDK_UPDATE event
Copy file name to clipboardExpand all lines: src/useSplitClient.ts
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ export function useSplitClient(options?: IUseSplitClientOptions): ISplitContextV
31
31
constcontext=useSplitContext();
32
32
const{client: contextClient, factory }=context;
33
33
34
-
// @TODO Move `getSplitClient` side effects
34
+
// @TODO Move `getSplitClient` side effects and reduce the function cognitive complexity
35
35
// @TODO Once `SplitClient` is removed, which updates the context, simplify next line as `const client = factory ? getSplitClient(factory, splitKey) : undefined;`
0 commit comments