Skip to content

Commit 4b353cf

Browse files
Merge pull request #216 from splitio/development
Release v2.0.0
2 parents e31343a + 5f34c9b commit 4b353cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1464
-1905
lines changed

.eslintrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
'plugins': [
1919
'react',
2020
'@typescript-eslint',
21+
'eslint-plugin-tsdoc',
2122
'import'
2223
],
2324
'rules': {
@@ -63,5 +64,11 @@ module.exports = {
6364
'import/no-self-import': 'error',
6465
'import/no-default-export': 'error',
6566
}
67+
}, {
68+
// Enable TSDoc rules for TypeScript files, allowing the use of JSDoc in JS files.
69+
'files': ['**/*.ts', '**/*.tsx'],
70+
'rules': {
71+
'tsdoc/syntax': 'warn'
72+
}
6673
}]
6774
}

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.DS_Store
22
/.vscode
33
/node_modules
4-
/lib
5-
/es
4+
/cjs
5+
/esm
66
/umd
77
/types
88
/coverage

CHANGES.txt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2.0.0 (November 1, 2024)
2+
- Added support for targeting rules based on large segments.
3+
- Added support for passing factory instances to the `factory` prop of the `SplitFactoryProvider` component from other SDK packages that extends the `SplitIO.IBrowserSDK` interface, such as `@splitsoftware/splitio-react-native`, `@splitsoftware/splitio-browserjs` and `@splitsoftware/browser-suite` packages.
4+
- Updated @splitsoftware/splitio package to version 11.0.0 that includes major updates, and updated some transitive dependencies for vulnerability fixes.
5+
- Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for ECMAScript Modules build.
6+
- Bugfixing - When the `config` prop is provided, the `SplitFactoryProvider` now makes the SDK factory and client instances available in the context immediately during the initial render, instead of waiting for the first SDK event (Related to https://github.com/splitio/react-client/issues/198). This change fixes a bug in the `useTrack` hook, which was not retrieving the client's `track` method during the initial render.
7+
- BREAKING CHANGES:
8+
- Updated the default value of the `updateOnSdkUpdate` and `updateOnSdkTimedout` parameters of the `useSplitClient` and `useSplitTreatments` hooks options object to `true`, to re-render on all SDK events by default. The same applies for the equivalent props in the `[with]SplitClient` and `[with]SplitTreatments` components.
9+
- Updated error handling: using the library modules without wrapping them in a `SplitFactoryProvider` component will now throw an error instead of logging it, as the modules requires the `SplitContext` to work properly.
10+
- Updated the `SplitFactoryProvider` component to not accept a child as a function (render prop), to avoid unnecessary re-renders when using the library hooks. Refer to ./MIGRATION-GUIDE.md for instructions on how to migrate the child as a function to a regular component.
11+
- Removed the `core.trafficType` option from the SDK configuration object, and the `trafficType` parameter from the SDK `client()` method, `useSplitClient`, `useTrack`, `withSplitClient` and `SplitClient` component. This is because traffic types can no longer be bound to SDK clients in JavaScript SDK v11.0.0, and so the traffic type must be provided as first argument in the `track` method calls.
12+
- Removed deprecated modules: `SplitFactory` component, `useClient`, `useTreatments` and `useManager` hooks. Refer to ./MIGRATION-GUIDE.md for instructions on how to migrate to the new alternatives.
13+
- Renamed `SplitSdk` to `SplitFactory` function, which is the underlying Split SDK factory, i.e., `import { SplitFactory } from '@splitsoftware/splitio'`.
14+
- Renamed TypeScript interface: `ISplitFactoryProps` to `ISplitFactoryProviderProps`.
15+
- Dropped support for React below 16.8.0, as the library components where rewritten using the React Hooks API available in React v16.8.0 and above. This refactor simplifies code maintenance and reduces bundle size.
16+
117
1.13.0 (September 6, 2024)
218
- Updated @splitsoftware/splitio package to version 10.28.0 that includes minor updates:
319
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.

MIGRATION-GUIDE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Notable changes to consider when migrating:
1414

1515
- When using the `config` prop with `SplitFactoryProvider`, the `factory` and `client` properties in `SplitContext` and the `manager` property in `useSplitManager` results 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`, `client`, and `manager` were immediately available. Nonetheless, it is not recommended to use the `client` and `factory` properties directly as better alternatives are available. For example, use the `useTrack` and `useSplitTreatments` hooks rather than the client's `track` and `getTreatments` methods.
1616

17-
- Updating the `config` prop in `SplitFactoryProvider` reinitializes the SDK with the new configuration, while `SplitFactory` does not reinitialize the SDK. You should pass a reference to the configuration object (e.g., via a global variable, `useState`, or `useMemo`) rather than a new instance on each render, to avoid unnecessary reinitializations.
17+
- Updating the `config` prop in `SplitFactoryProvider` re-initializes the SDK with the new configuration, while `SplitFactory` does not reinitialize the SDK. You should pass a reference to the configuration object (e.g., via a global variable, `useState`, or `useMemo`) rather than a new instance on each render, to avoid unnecessary re-initializations.
1818

1919
- Updating the `factory` prop in `SplitFactoryProvider` replaces the current SDK instance, unlike `SplitFactory` where it is ignored.
2020

0 commit comments

Comments
 (0)