Skip to content

Commit b927510

Browse files
rollback rc
1 parent f6f44d6 commit b927510

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

.github/workflows/ci-cd.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: echo "VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
5050

5151
- name: SonarQube Scan (Push)
52-
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/revert_hocs_and_render_props')
52+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development')
5353
uses: SonarSource/[email protected]
5454
env:
5555
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
@@ -77,7 +77,7 @@ jobs:
7777
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
7878
7979
- name: Store assets
80-
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/revert_hocs_and_render_props')
80+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development')
8181
uses: actions/upload-artifact@v3
8282
with:
8383
name: assets
@@ -88,7 +88,7 @@ jobs:
8888
name: Upload assets
8989
runs-on: ubuntu-latest
9090
needs: build
91-
if: github.event_name == 'push' && github.ref == 'refs/heads/revert_hocs_and_render_props'
91+
if: github.event_name == 'push' && github.ref == 'refs/heads/development'
9292
strategy:
9393
matrix:
9494
environment:

CHANGES.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +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-
- Updated the default value of the `updateOnSdkUpdate` and `updateOnSdkTimedout` parameters of the `useSplitClient` and `useSplitTreatments` hooks options object to `true`, to re-render by default when the SDK client emits the `SDK_UPDATE` or `SDK_READY_TIMED_OUT` events. The same applies for the equivalent props in the `[with]SplitClient` and `[with]SplitTreatments` components.
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.
99
- 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.
1010
- 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.
1111
- 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.

src/__tests__/SplitFactoryProvider.test.tsx

+27
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,31 @@ describe('SplitFactoryProvider', () => {
208208
expect(destroySpy).not.toBeCalled();
209209
});
210210

211+
test('passes attributes to the main client if provided.', () => {
212+
(SplitFactory as jest.Mock).mockClear();
213+
let client;
214+
215+
const Component = () => {
216+
client = useSplitContext().client;
217+
return null;
218+
}
219+
220+
const wrapper = render(
221+
<SplitFactoryProvider config={sdkBrowser} attributes={{ attr1: 'value1' }} >
222+
<Component />
223+
</SplitFactoryProvider>
224+
);
225+
226+
expect(client.getAttributes()).toEqual({ attr1: 'value1' });
227+
228+
wrapper.rerender(
229+
<SplitFactoryProvider config={sdkBrowser} attributes={{ attr1: 'value2' }} >
230+
<Component />
231+
</SplitFactoryProvider>
232+
);
233+
234+
expect(client.getAttributes()).toEqual({ attr1: 'value2' });
235+
expect(SplitFactory).toBeCalledTimes(1);
236+
});
237+
211238
});

0 commit comments

Comments
 (0)