From 53575c7d0c104b9c54566fffc4be9f9f5851faa8 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 12 Dec 2023 15:40:26 -0300 Subject: [PATCH] Update JS SDK --- CHANGES.txt | 5 +++- package-lock.json | 46 +++++++++++++++--------------- package.json | 4 +-- src/__tests__/SplitClient.test.tsx | 26 +++++++++++++++++ src/index.ts | 2 +- 5 files changed, 56 insertions(+), 27 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index fa41185..025fc9a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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, which 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): diff --git a/package-lock.json b/package-lock.json index 3510e55..6e79190 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio-react", - "version": "1.10.1", + "version": "1.10.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-react", - "version": "1.10.1", + "version": "1.10.2", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio": "10.24.0-beta", + "@splitsoftware/splitio": "10.24.1", "memoize-one": "^5.1.1", "shallowequal": "^1.1.0" }, @@ -57,9 +57,9 @@ } }, "node_modules/@adobe/css-tools": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.1.tgz", - "integrity": "sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.2.tgz", + "integrity": "sha512-DA5a1C0gD/pLOvhv33YMrbf2FK3oUzwNl9oOJqE4XVjuEtt6XIakRcsd7eLiOSPkp1kTRQGICTA8cKra/vFbjw==", "dev": true }, "node_modules/@babel/code-frame": { @@ -1547,11 +1547,11 @@ } }, "node_modules/@splitsoftware/splitio": { - "version": "10.24.0-beta", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.24.0-beta.tgz", - "integrity": "sha512-SpYsWoZKLNXtQjQ5xJLJ2BaLZFZBSH3vRJXuYgf1BpsSv6n0s3Lc1NJ4gDI0zRCvGjWEfLOz6VrdBM0klRao8w==", + "version": "10.24.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.24.1.tgz", + "integrity": "sha512-WzVZrP2IAqzNBywNXgmLxiS60qumkcnu6u1lUPlNgdVek82TzWeqyqW+htKmDMJ/ifsJPWrgT1VLMZJvOnBsVA==", "dependencies": { - "@splitsoftware/splitio-commons": "1.10.1-rc.3", + "@splitsoftware/splitio-commons": "1.12.1", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -1569,9 +1569,9 @@ } }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.10.1-rc.3", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.10.1-rc.3.tgz", - "integrity": "sha512-eqJxAMtqFK7fXFKL8gMGfRsMBdxrYI9tIGUHHpY1NcyeKkn4OWqAOZMhX6z2qLdBArzHi34Li0Lb72o+Bh1Tqg==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1.tgz", + "integrity": "sha512-EkCcqlYvVafazs9c5i+pmhf6rIyj3A70dqQ4U3BKE646t7tf6mxGzqZz1sAl540xNyYI7CA/iIqisEWvDtJc0A==", "dependencies": { "tslib": "^2.3.1" }, @@ -10963,9 +10963,9 @@ "dev": true }, "@adobe/css-tools": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.1.tgz", - "integrity": "sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.2.tgz", + "integrity": "sha512-DA5a1C0gD/pLOvhv33YMrbf2FK3oUzwNl9oOJqE4XVjuEtt6XIakRcsd7eLiOSPkp1kTRQGICTA8cKra/vFbjw==", "dev": true }, "@babel/code-frame": { @@ -12089,11 +12089,11 @@ } }, "@splitsoftware/splitio": { - "version": "10.24.0-beta", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.24.0-beta.tgz", - "integrity": "sha512-SpYsWoZKLNXtQjQ5xJLJ2BaLZFZBSH3vRJXuYgf1BpsSv6n0s3Lc1NJ4gDI0zRCvGjWEfLOz6VrdBM0klRao8w==", + "version": "10.24.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.24.1.tgz", + "integrity": "sha512-WzVZrP2IAqzNBywNXgmLxiS60qumkcnu6u1lUPlNgdVek82TzWeqyqW+htKmDMJ/ifsJPWrgT1VLMZJvOnBsVA==", "requires": { - "@splitsoftware/splitio-commons": "1.10.1-rc.3", + "@splitsoftware/splitio-commons": "1.12.1", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -12105,9 +12105,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.10.1-rc.3", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.10.1-rc.3.tgz", - "integrity": "sha512-eqJxAMtqFK7fXFKL8gMGfRsMBdxrYI9tIGUHHpY1NcyeKkn4OWqAOZMhX6z2qLdBArzHi34Li0Lb72o+Bh1Tqg==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1.tgz", + "integrity": "sha512-EkCcqlYvVafazs9c5i+pmhf6rIyj3A70dqQ4U3BKE646t7tf6mxGzqZz1sAl540xNyYI7CA/iIqisEWvDtJc0A==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index 2559917..41ed506 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" }, diff --git a/src/__tests__/SplitClient.test.tsx b/src/__tests__/SplitClient.test.tsx index 4bc4a90..482403e 100644 --- a/src/__tests__/SplitClient.test.tsx +++ b/src/__tests__/SplitClient.test.tsx @@ -47,6 +47,7 @@ describe('SplitClient', () => { render( + {/* Equivalent to */} {({ client, isReady, isReadyFromCache, hasTimedout, isTimedout, isDestroyed, lastUpdate }: ISplitClientChildProps) => { expect(client).toBe(outerFactory.client()); @@ -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( + + + {({ 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; + }} + + + ); + + expect(count).toEqual(2); + }); + test('renders a passed JSX.Element with a new SplitContext value.', (done) => { const outerFactory = SplitSdk(sdkBrowser); diff --git a/src/index.ts b/src/index.ts index f25e6fb..1e2dddd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,5 +36,5 @@ export type { ISplitTreatmentsProps, IUpdateProps, IUseSplitClientOptions, - IUseSplitTreatmentsOptions, + IUseSplitTreatmentsOptions } from './types';