Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Nov 1, 2024
1 parent a715ff4 commit 8521d37
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ISplitClientChildProps,
ISplitClientProps,
ISplitContextValues,
ISplitFactoryChildProps,
ISplitFactoryProviderProps,
ISplitStatus,
ISplitTreatmentsChildProps,
Expand Down
4 changes: 1 addition & 3 deletions src/__tests__/useSplitClient.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ describe('useSplitClient', () => {
{() => countSplitContext++}
</SplitContext.Consumer>
{React.createElement(() => {
// Equivalent to
// - Using config key: `const { client } = useSplitClient({ splitKey: sdkBrowser.core.key, attributes: { att1: 'att1' } });`
// - Disabling update props, since the wrapping SplitFactoryProvider has them enabled: `const { client } = useSplitClient({ attributes: { att1: 'att1' }, updateOnSdkReady: false, updateOnSdkReadyFromCache: false });`
// Equivalent to using config key: `const { client } = useSplitClient({ splitKey: sdkBrowser.core.key, attributes: { att1: 'att1' } });`
const { client } = useSplitClient({ attributes: { att1: 'att1' } });
expect(client).toBe(mainClient); // Assert that the main client was retrieved.
expect(client!.getAttributes()).toEqual({ att1: 'att1' }); // Assert that the client was retrieved with the provided attributes.
Expand Down
6 changes: 4 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ export interface IUpdateProps {
/**
* `updateOnSdkReadyFromCache` indicates if the component will update (i.e., re-render) in case of a `SDK_READY_FROM_CACHE` event.
* If `true`, components consuming the context (such as `SplitClient` and `SplitTreatments`) will re-render on `SDK_READY_FROM_CACHE`.
* This params is only relevant when using 'LOCALSTORAGE' as storage type, since otherwise the event is never emitted.
* This params is only relevant when using `'LOCALSTORAGE'` as storage type, since otherwise the event is never emitted.
* It's value is `true` by default.
*/
updateOnSdkReadyFromCache?: boolean;
}

/**
* SplitFactoryProvider Child Props interface. These are the props that the child component receives from the 'withSplitFactory' HOC.
* Props interface for components wrapped by the `withSplitFactory` HOC. These props are provided by the HOC to the wrapped component.
*
* @deprecated `withSplitFactory` will be removed in a future major release. We recommend replacing it with the `SplitFactoryProvider` component.
*/
export interface ISplitFactoryChildProps extends ISplitContextValues { }

Expand Down

0 comments on commit 8521d37

Please sign in to comment.