diff --git a/CHANGES.txt b/CHANGES.txt index dd1026b..3ece218 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,9 @@ -1.11.0 (January 15, 2023) - - Added new `SplitFactoryProvider` component as replacement for the now deprecated `SplitFactory` component. - This new component is a fixed version of the `SplitFactory` component, which is not handling the SDK initialization side-effects in the `componentDidMount` and `componentDidUpdate` methods (commit phase), causing some issues like the SDK not being reinitialized when component props change (Related to issue #11 and #148). - The new component also supports server-side rendering. See our documentation for more details: https://help.split.io/hc/en-us/articles/360038825091-React-SDK#server-side-rendering (Related to issue #11 and #109). +1.11.0 (January 16, 2023) + - Added the new `SplitFactoryProvider` component as a replacement for the now deprecated `SplitFactory` component. + The new component is a revised version of `SplitFactory`, addressing improper handling of the SDK initialization side-effects in the `componentDidMount` and `componentDidUpdate` methods (commit phase), causing some issues like memory leaks and the SDK not reinitializing when component props change (Related to issue #11 and #148). + The `SplitFactoryProvider` component can be used as a drop-in replacement for `SplitFactory`. It utilizes the React Hooks API, that requires React 16.8.0 or later, and supports server-side rendering. See our documentation for more details (Related to issue #11 and #109). - Updated internal code to remove a circular dependency and avoid warning messages with tools like PNPM (Related to issue #176). + - Updated @splitsoftware/splitio package to version 10.25.1 for vulnerability fixes. 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. diff --git a/package-lock.json b/package-lock.json index 99d919c..ebb053f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio-react", - "version": "1.10.3-rc.3", + "version": "1.10.3-rc.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-react", - "version": "1.10.3-rc.3", + "version": "1.10.3-rc.4", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio": "10.25.1-rc.0", + "@splitsoftware/splitio": "10.25.1", "memoize-one": "^5.1.1", "shallowequal": "^1.1.0" }, @@ -1547,9 +1547,9 @@ } }, "node_modules/@splitsoftware/splitio": { - "version": "10.25.1-rc.0", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.25.1-rc.0.tgz", - "integrity": "sha512-lSfNKoloima/kjtn1W/fJFj9l0WuwE+iSOKgRn13AgWdSE7vdr71qJ0ZLuwmk0HLjv52OnAgSGi0DbS+0qM6Ow==", + "version": "10.25.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.25.1.tgz", + "integrity": "sha512-QmCOI2VNhjIMieibtMcc595oyQB5sgrYKSqw7wxKtwMX0VtuPbZ3Lw8fwd0nH2WSKq3Pcjyu3nVSYQRp1bGEvA==", "dependencies": { "@splitsoftware/splitio-commons": "1.13.1", "@types/google.analytics": "0.0.40", @@ -12089,9 +12089,9 @@ } }, "@splitsoftware/splitio": { - "version": "10.25.1-rc.0", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.25.1-rc.0.tgz", - "integrity": "sha512-lSfNKoloima/kjtn1W/fJFj9l0WuwE+iSOKgRn13AgWdSE7vdr71qJ0ZLuwmk0HLjv52OnAgSGi0DbS+0qM6Ow==", + "version": "10.25.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.25.1.tgz", + "integrity": "sha512-QmCOI2VNhjIMieibtMcc595oyQB5sgrYKSqw7wxKtwMX0VtuPbZ3Lw8fwd0nH2WSKq3Pcjyu3nVSYQRp1bGEvA==", "requires": { "@splitsoftware/splitio-commons": "1.13.1", "@types/google.analytics": "0.0.40", diff --git a/package.json b/package.json index f1608a7..0e08796 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react", - "version": "1.10.3-rc.3", + "version": "1.10.3-rc.4", "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.25.1-rc.0", + "@splitsoftware/splitio": "10.25.1", "memoize-one": "^5.1.1", "shallowequal": "^1.1.0" }, diff --git a/src/SplitFactory.tsx b/src/SplitFactory.tsx index 4beb60d..74d9236 100644 --- a/src/SplitFactory.tsx +++ b/src/SplitFactory.tsx @@ -9,14 +9,15 @@ import { DEFAULT_UPDATE_OPTIONS } from './useSplitClient'; /** * SplitFactory will initialize the Split SDK and its main client, listen for its events in order to update the Split Context, * and automatically shutdown and release resources when it is unmounted. SplitFactory must wrap other components and functions - * from this library, since they access the Split Context and its elements (factory, clients, etc). + * from this library, since they access the Split Context and its properties (factory, client, isReady, etc). * * The underlying SDK factory and client is set on the constructor, and cannot be changed during the component lifecycle, * even if the component is updated with a different config or factory prop. * * @deprecated Replace with the new `SplitFactoryProvider` component. * `SplitFactoryProvider` is a drop-in replacement that properly handles side effects (factory creation and destruction) within the React component lifecycle, avoiding issues with factory recreation and memory leaks. - * Note: There is a subtle breaking change in `SplitFactoryProvider`. When using the `config` prop, `factory` and `client` properties in the context are `null` in the first render, until the context is updated when the factory is ready. This differs from the previous behavior where `factory` and `client` were immediately available. + * Note: There is a subtle breaking change in `SplitFactoryProvider`. When using the `config` prop, `factory` and `client` properties in the context are `null` in the first render, until the context is updated when some event is emitted on + * the SDK main client (ready, ready from cache, timeout or update depending on the configuration of the `updateOnXXX` props of the component). This differs from the previous behavior where `factory` and `client` were immediately available. * * @see {@link https://help.split.io/hc/en-us/articles/360038825091-React-SDK#2-instantiate-the-sdk-and-create-a-new-split-client} */ diff --git a/src/SplitFactoryProvider.tsx b/src/SplitFactoryProvider.tsx index 4ecfd3c..5f91df7 100644 --- a/src/SplitFactoryProvider.tsx +++ b/src/SplitFactoryProvider.tsx @@ -7,9 +7,9 @@ import { getSplitFactory, destroySplitFactory, IFactoryWithClients, getSplitClie import { DEFAULT_UPDATE_OPTIONS } from './useSplitClient'; /** - * SplitFactoryProvider will initialize the Split SDK and its main client when it is mounted, listen for its events in order to update the Split Context, - * and automatically shutdown and release resources when it is unmounted. SplitFactoryProvider must wrap other library components and functions - * since they access the Split Context and its elements (factory, clients, etc). + * SplitFactoryProvider will initialize the Split SDK and its main client when `config` prop is provided or updated, listen for its events in order to update the Split Context, + * and automatically destroy the SDK (shutdown and release resources) when it is unmounted or `config` prop updated. SplitFactoryProvider must wrap other library components and + * functions since they access the Split Context and its properties (factory, client, isReady, etc). * * NOTE: Either pass a factory instance or a config object. If both are passed, the config object will be ignored. * Pass the same reference to the config or factory object rather than a new instance on each render, to avoid unnecessary props changes and SDK reinitializations. diff --git a/src/withSplitFactory.tsx b/src/withSplitFactory.tsx index 76f2827..45eb55f 100644 --- a/src/withSplitFactory.tsx +++ b/src/withSplitFactory.tsx @@ -12,7 +12,8 @@ import { SplitFactory } from './SplitFactory'; * * @deprecated Use `SplitFactoryProvider` instead. * `SplitFactoryProvider` is a drop-in replacement of `SplitFactory` that properly handles side effects (factory creation and destruction) within the React component lifecycle, avoiding issues with factory recreation and memory leaks. - * Note: There is a subtle breaking change in `SplitFactoryProvider`. When using the `config` prop, `factory` and `client` properties in the context are `null` in the first render, until the context is updated when the factory is ready. This differs from the previous behavior where `factory` and `client` were immediately available. + * Note: There is a subtle breaking change in `SplitFactoryProvider`. When using the `config` prop, `factory` and `client` properties in the context are `null` in the first render, until the context is updated when some event is emitted on + * the SDK main client (ready, ready from cache, timeout or update depending on the configuration of the `updateOnXXX` props of the component). This differs from the previous behavior where `factory` and `client` were immediately available. */ export function withSplitFactory(config?: SplitIO.IBrowserSettings, factory?: SplitIO.IBrowserSDK, attributes?: SplitIO.Attributes) {