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
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,12 @@
1
1
1.11.0 (January 16, 2023)
2
-
- Added the new `SplitFactoryProvider` component as a replacement for the now deprecated `SplitFactory` component.
3
-
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).
4
-
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).
2
+
- Added new `SplitFactoryProvider` component as a replacement for the now deprecated `SplitFactory` component.
3
+
- The `SplitFactoryProvider` component, a drop-in replacement for `SplitFactory`, supports server-side rendering (Related to issues #11 and #109). For more details, see our documentation.
4
+
- Bugfixing - The new component is a revised version of `SplitFactory` that addresses improper handling of SDK initialization side-effects in the `componentDidMount` and `componentDidUpdate` methods (commit phase), resolving memory leak issues on server-side, React development and strict modes. It also ensures the SDK is updated when component props change (Related to issues #11 and #148).
5
+
- BREAKING CHANGES when migrating from `SplitFactory` to `SplitFactoryProvider`:
6
+
- `SplitFactoryProvider` utilizes the React Hooks API, requiring React 16.8.0 or later, while `SplitFactory` is compatible with React 16.3.0 or later.
7
+
- When using the `config` prop with `SplitFactoryProvider`, `factory` and `client` properties in `SplitContext` 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 `updateOn<Event>` props of the component). This differs from the previous behavior where `factory` and `client` were immediately available.
8
+
- Updating the `config` prop in `SplitFactoryProvider` reinitializes the SDK with the new configuration, while `SplitFactory` does not reinitialize the SDK. Pass a reference to the configuration object (e.g., via a global variable, `useState`, or `useMemo`) rather than a new instance to avoid unnecessary reinitialization.
9
+
- Updating the `factory` prop in `SplitFactoryProvider` replaces the current SDK instance, unlike `SplitFactory` where it is ignored.
5
10
- Updated internal code to remove a circular dependency and avoid warning messages with tools like PNPM (Related to issue #176).
6
11
- Updated @splitsoftware/splitio package to version 10.25.1 for vulnerability fixes.
Copy file name to clipboardExpand all lines: src/SplitFactory.tsx
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,17 @@ import { DEFAULT_UPDATE_OPTIONS } from './useSplitClient';
15
15
* even if the component is updated with a different config or factory prop.
16
16
*
17
17
* @deprecated Replace with the new `SplitFactoryProvider` component.
18
-
* `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.
19
-
* 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
20
-
* 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.
18
+
* `SplitFactoryProvider` is a drop-in replacement that properly handles side effects (factory creation and destruction) within
19
+
* the React component lifecycle, resolving memory leak issues on server-side, React development and strict modes.
20
+
*
21
+
* BREAKING CHANGES to consider when migrating:
22
+
* - `SplitFactoryProvider` utilizes the React Hooks API, requiring React 16.8.0 or later, while `SplitFactory` is compatible with React 16.3.0 or later.
23
+
* - When using the `config` prop with `SplitFactoryProvider`, `factory` and `client` properties in `SplitContext` are `null` in the first render, until
24
+
* 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
25
+
* of the `updateOn<Event>` props of the component). This differs from the previous behavior where `factory` and `client` were immediately available.
26
+
* - Updating the `config` prop in `SplitFactoryProvider` reinitializes the SDK with the new configuration, while `SplitFactory` does not reinitialize the SDK.
27
+
* Pass a reference to the configuration object (e.g., via a global variable, `useState`, or `useMemo`) rather than a new instance to avoid unnecessary reinitialization.
28
+
* - Updating the `factory` prop in `SplitFactoryProvider` replaces the current SDK instance, unlike `SplitFactory` where it is ignored.
Copy file name to clipboardExpand all lines: src/withSplitFactory.tsx
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,18 @@ import { SplitFactory } from './SplitFactory';
10
10
* @param config Config object used to instantiate a Split factory
11
11
* @param factory Split factory instance to use instead of creating a new one with the config object.
12
12
*
13
-
* @deprecated Use `SplitFactoryProvider` instead.
14
-
* `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.
15
-
* 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
16
-
* 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.
13
+
* @deprecated Replace with the new `SplitFactoryProvider` component.
14
+
* `SplitFactoryProvider` is a drop-in replacement of `SplitFactory` that properly handles side effects (factory creation and destruction) within
15
+
* the React component lifecycle, resolving memory leak issues on server-side, React development and strict modes.
16
+
*
17
+
* BREAKING CHANGES to consider when migrating:
18
+
* - `SplitFactoryProvider` utilizes the React Hooks API, requiring React 16.8.0 or later, while `SplitFactory` is compatible with React 16.3.0 or later.
19
+
* - When using the `config` prop with `SplitFactoryProvider`, `factory` and `client` properties in `SplitContext` are `null` in the first render, until
20
+
* 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
21
+
* of the `updateOn<Event>` props of the component). This differs from the previous behavior where `factory` and `client` were immediately available.
22
+
* - Updating the `config` prop in `SplitFactoryProvider` reinitializes the SDK with the new configuration, while `SplitFactory` does not reinitialize the SDK.
23
+
* Pass a reference to the configuration object (e.g., via a global variable, `useState`, or `useMemo`) rather than a new instance to avoid unnecessary reinitialization.
24
+
* - Updating the `factory` prop in `SplitFactoryProvider` replaces the current SDK instance, unlike `SplitFactory` where it is ignored.
0 commit comments