Skip to content

Commit e37c41a

Browse files
prepare stable version
1 parent 5fea2f4 commit e37c41a

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
1.10.1 (November 21, 2023)
2-
- Bugfixing - Resolved an issue with `useSplitClient` hook, which was not re-rendering when an SDK client event was emitted between the hook's call and the execution of its internal effect.
2+
- 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).
33

44
1.10.0 (November 16, 2023)
55
- 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):

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-react",
3-
"version": "1.10.1-rc.0",
3+
"version": "1.10.1",
44
"description": "A React library to easily integrate and use Split JS SDK",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/__tests__/useSplitClient.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('useSplitClient', () => {
8282

8383
// eslint-disable-next-line react/prop-types
8484
const InnerComponent = ({ splitKey, attributesClient, testSwitch }) => {
85-
useSplitClient({ splitKey, trafficType: 'user', attributes: attributesClient});
85+
useSplitClient({ splitKey, trafficType: 'user', attributes: attributesClient });
8686
testSwitch(done, splitKey);
8787
return null;
8888
};

src/useSplitClient.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function useSplitClient(options?: IUseSplitClientOptions): ISplitContextV
3333

3434
let client = contextClient as IClientWithContext;
3535
if (splitKey && factory) {
36+
// @TODO `getSplitClient` starts client sync. Move side effects to useEffect
3637
client = getSplitClient(factory, splitKey, trafficType);
3738
}
3839
initAttributes(client, attributes);
@@ -46,9 +47,10 @@ export function useSplitClient(options?: IUseSplitClientOptions): ISplitContextV
4647

4748
const update = () => setLastUpdate(client.lastUpdate);
4849

49-
// Subscribe to SDK events
50-
const statusOnEffect = getStatus(client); // Effect call is not synchronous, so the status may have changed
50+
// Clients are created on the hook's call, so the status may have changed
51+
const statusOnEffect = getStatus(client);
5152

53+
// Subscribe to SDK events
5254
if (updateOnSdkReady) {
5355
if (!statusOnEffect.isReady) client.once(client.Event.SDK_READY, update);
5456
else if (!status.isReady) update();

0 commit comments

Comments
 (0)