Skip to content

Commit 7acd623

Browse files
Lena's feedback
1 parent 2897070 commit 7acd623

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

.github/workflows/ci-cd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
fetch-depth: 0
2929

30-
- name: Set up nodejs
30+
- name: Set up Node.js
3131
uses: actions/setup-node@v3
3232
with:
3333
node-version: 'lts/*'

CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for ECMAScript Modules build.
66
- 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.
77
- BREAKING CHANGES:
8+
- NOTE: Refer to ./MIGRATION-GUIDE.md for instructions on how to migrate your codebase from version 1.x to 2.0.0.
89
- 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.
910
- 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.
1011
- 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 your component to be passed as a regular React JSX element if you were using this pattern.

MIGRATION-GUIDE.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
React SDK v2.0.0 has a few breaking changes that you should consider when migrating from a previous version. The main changes are:
55

6-
- **Deprecated `useClient`, `useTreatments`, and `useManager` hooks have been removed.**
6+
### Deprecated `useClient`, `useTreatments`, and `useManager` hooks have been removed.
77

8-
Follow [this section](#migrating-to-get-react-sdk-v1100-improvements-replacing-the-deprecated-useclient-usetreatments-and-usemanager-hooks) to migrate to the new hooks `useSplitClient`, `useSplitTreatments`, and `useSplitManager` respectively.
8+
Follow [this section](#migrating-to-get-react-sdk-v1100-improvements-replacing-the-deprecated-useclient-usetreatments-and-usemanager-hooks) to migrate to the new hooks `useSplitClient`, `useSplitTreatments`, and `useSplitManager`.
99

10-
- **Deprecated `SplitFactory` provider has been removed, `withSplitFactory` is deprecated, and `SplitFactoryProvider` doesn't accept `updateOn` props and a render function as children anymore.**
10+
### Deprecated `SplitFactory` provider has been removed, `withSplitFactory` is deprecated, and `SplitFactoryProvider` doesn't accept `updateOn` props and a render function as children anymore.
1111

1212
To migrate your existing code to the new version of `SplitFactoryProvider`, consider the following refactor example:
1313

@@ -62,7 +62,7 @@ const App = () => {
6262
Notice that `MyComponent` was refactored to use the `useSplitClient` hook and is passed as a React JSX element rather than a render function.
6363
The `useSplitClient` hook is called without providing an `splitKey` param, meaning that the default client, which key is set in the `core.key` property of the `mySplitConfig` object, will be used, and the `updateOn` and `attributes` props are passed as options to the hook.
6464

65-
- **High-Order-Components (`withSplitClient`, `withSplitTreatments`) and components that accept a render function as child component (`SplitTreatments`, and `SplitClient`) have been deprecated and might be removed in a future major release.**
65+
### High-Order-Components (`withSplitClient`, `withSplitTreatments`) and components that accept a render function as child component (`SplitTreatments`, and `SplitClient`) have been deprecated and might be removed in a future major release.
6666

6767
The deprecation is intended to simplify the API and discourage using old patterns (HOCs and render props) in favor of the *hook* alternatives, to take advantage of React optimizations.
6868

@@ -158,7 +158,7 @@ const App = () => {
158158
};
159159
```
160160

161-
- **Renamed `SplitSdk` function to `SplitFactory`.**
161+
### Renamed `SplitSdk` function to `SplitFactory`.
162162

163163
If you are using the `SplitSdk` function to create a factory and pass it to the `SplitFactoryProvider` component, you should rename it to `SplitFactory`. For example:
164164

@@ -192,9 +192,9 @@ const App = () => {
192192
};
193193
```
194194

195-
- **Traffic type cannot be bound to SDK clients anymore.**
195+
### Traffic type cannot be bound to SDK clients anymore.
196196

197-
If you were passing the `trafficType` to the SDK config or the `useSplitClient` or `useTrack` hooks, you should remove it. The `trafficType` is now required to be passed as initial argument of the `track` method. For example:
197+
If you were passing the `trafficType` to the SDK config, `useSplitClient` hook, or `useTrack` hook, you should remove it. The `trafficType` must now be passed as the first argument of the `track` method. For example:
198198

199199
```tsx
200200
const mySplitConfig = {

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This SDK is designed to work with Split, the platform for controlled rollouts, w
99

1010
## Compatibility
1111

12-
This SDK is compatible with React 16.8.0 and above, since it uses **React Hooks API** introduced in that version.
12+
This SDK is compatible with React 16.8.0 and above, since it uses [React Hooks API](https://react.dev/reference/react/hooks) introduced in that version.
1313

1414
## Getting started
1515
Below is a simple example that describes the instantiation and most basic usage of our SDK:
@@ -83,7 +83,7 @@ Split has built and maintains SDKs for:
8383
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
8484
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
8585
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
86-
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
86+
* Node.js [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
8787
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
8888
* PHP thin-client [Github](https://github.com/splitio/php-thin-client) [Docs](https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-SDK)
8989
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)

webpack.common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
],
3131
},
3232

33-
node: false, // Not include Node polyfills, https://webpack.js.org/configuration/node
33+
node: false, // Not include Node.js polyfills, https://webpack.js.org/configuration/node
3434
target: ['web', 'es5'], // target 'es5', since 'es2015' is the default in Webpack 5
3535

3636
externals: {

0 commit comments

Comments
 (0)