Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
1.10.2 (December 12, 2023)
- Updated @splitsoftware/splitio package to version 10.24.1 that updates localStorage usage to clear cached feature flag definitions before initiating the synchronization process, if the cache was previously synchronized with a different SDK key (i.e., a different environment) or different Split Filter criteria, to avoid using invalid cached data when the SDK is ready from cache.

1.10.1 (November 21, 2023)
- Bugfixing - Resolved an issue with `useSplitClient` hook, which was not re-rendering when an SDK client event was emitted between the hook's call (render phase) and the execution of its internal effect (commit phase).
- Bugfixing - Resolved an issue with `useSplitClient` hook and `SplitClient` component, that were not re-rendering when an SDK client event was emitted between the render and the commit phases of component lifecycle.

1.10.0 (November 16, 2023)
- Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation):
Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-react",
"version": "1.10.1",
"version": "1.10.2",
"description": "A React library to easily integrate and use Split JS SDK",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -62,7 +62,7 @@
},
"homepage": "https://github.com/splitio/react-client#readme",
"dependencies": {
"@splitsoftware/splitio": "10.24.0-beta",
"@splitsoftware/splitio": "10.24.1",
"memoize-one": "^5.1.1",
"shallowequal": "^1.1.0"
},
Expand Down
26 changes: 26 additions & 0 deletions src/__tests__/SplitClient.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('SplitClient', () => {

render(
<SplitFactory factory={outerFactory} >
{/* Equivalent to <SplitClient splitKey={undefined} > */}
<SplitClient splitKey={sdkBrowser.core.key} >
{({ client, isReady, isReadyFromCache, hasTimedout, isTimedout, isDestroyed, lastUpdate }: ISplitClientChildProps) => {
expect(client).toBe(outerFactory.client());
Expand Down Expand Up @@ -201,6 +202,31 @@ describe('SplitClient', () => {
expect(renderTimes).toBe(2);
});

test('must update on SDK events between the render and commit phases', () => {
const outerFactory = SplitSdk(sdkBrowser);
let count = 0;

render(
<SplitFactory factory={outerFactory} >
<SplitClient splitKey='some_user' >
{({ client }) => {
count++;

// side effect in the render phase
if (!(client as any).__getStatus().isReady) {
console.log('emit');
(client as any).__emitter__.emit(Event.SDK_READY);
}

return null;
}}
</SplitClient>
</SplitFactory>
);

expect(count).toEqual(2);
});

test('renders a passed JSX.Element with a new SplitContext value.', (done) => {
const outerFactory = SplitSdk(sdkBrowser);

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export type {
ISplitTreatmentsProps,
IUpdateProps,
IUseSplitClientOptions,
IUseSplitTreatmentsOptions,
IUseSplitTreatmentsOptions
} from './types';