Skip to content

Commit b16ee83

Browse files
Remove redundant code and clarify type comments
1 parent cc1a622 commit b16ee83

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

.github/workflows/ci-cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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/default_options')
80+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development')
8181
uses: actions/upload-artifact@v4
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/default_options'
91+
if: github.event_name == 'push' && github.ref == 'refs/heads/development'
9292
strategy:
9393
matrix:
9494
environment:

src/SplitClient.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ export function SplitClient(props: ISplitClientProps) {
1717
const context = useSplitClient(props);
1818

1919
return (
20-
<SplitContext.Provider value={{
21-
...context,
22-
updateOnSdkReady: props.updateOnSdkReady ?? context.updateOnSdkReady,
23-
updateOnSdkReadyFromCache: props.updateOnSdkReadyFromCache ?? context.updateOnSdkReadyFromCache,
24-
updateOnSdkTimedout: props.updateOnSdkTimedout ?? context.updateOnSdkTimedout,
25-
updateOnSdkUpdate: props.updateOnSdkUpdate ?? context.updateOnSdkUpdate
26-
}}>
20+
<SplitContext.Provider value={context}>
2721
{
2822
typeof children === 'function' ?
2923
children(context) :

src/types.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface ISplitStatus {
3434
isDestroyed: boolean;
3535

3636
/**
37-
* `lastUpdate` indicates when the most recent status event was emitted. This timestamp is only updated for events that are being listened to,
37+
* `lastUpdate` indicates the timestamp of the most recent status event. This timestamp is only updated for events that are being listened to,
3838
* configured via the `updateOnSdkReady` option for `SDK_READY` event, `updateOnSdkReadyFromCache` for `SDK_READY_FROM_CACHE` event,
3939
* `updateOnSdkTimedout` for `SDK_READY_TIMED_OUT` event, and `updateOnSdkUpdate` for `SDK_UPDATE` event.
4040
*/
@@ -47,29 +47,25 @@ export interface ISplitStatus {
4747
export interface IUpdateProps {
4848

4949
/**
50-
* `updateOnSdkUpdate` indicates if the hook or component will update (i.e., re-render) in case of an `SDK_UPDATE` event.
51-
* If `true`, hooks or components consuming the context (such as `useSplitClient` and `useSplitTreatments`) will re-render on `SDK_UPDATE`.
50+
* `updateOnSdkUpdate` indicates if the hook or component will update (i.e., re-render) or not in case of an `SDK_UPDATE` event.
5251
* It's value is `true` by default.
5352
*/
5453
updateOnSdkUpdate?: boolean;
5554

5655
/**
57-
* `updateOnSdkTimedout` indicates if the hook or component will update (i.e., re-render) in case of a `SDK_READY_TIMED_OUT` event.
58-
* If `true`, hooks or components consuming the context (such as `useSplitClient` and `useSplitTreatments`) will re-render on `SDK_READY_TIMED_OUT`.
56+
* `updateOnSdkTimedout` indicates if the hook or component will update (i.e., re-render) or not in case of a `SDK_READY_TIMED_OUT` event.
5957
* It's value is `true` by default.
6058
*/
6159
updateOnSdkTimedout?: boolean;
6260

6361
/**
64-
* `updateOnSdkReady` indicates if the hook or component will update (i.e., re-render) in case of a `SDK_READY` event.
65-
* If `true`, hooks or components consuming the context (such as `useSplitClient` and `useSplitTreatments`) will re-render on `SDK_READY`.
62+
* `updateOnSdkReady` indicates if the hook or component will update (i.e., re-render) or not in case of a `SDK_READY` event.
6663
* It's value is `true` by default.
6764
*/
6865
updateOnSdkReady?: boolean;
6966

7067
/**
71-
* `updateOnSdkReadyFromCache` indicates if the hook or component will update (i.e., re-render) in case of a `SDK_READY_FROM_CACHE` event.
72-
* If `true`, hooks or components consuming the context (such as `useSplitClient` and `useSplitTreatments`) will re-render on `SDK_READY_FROM_CACHE`.
68+
* `updateOnSdkReadyFromCache` indicates if the hook or component will update (i.e., re-render) or not in case of a `SDK_READY_FROM_CACHE` event.
7369
* This params is only relevant when using `'LOCALSTORAGE'` as storage type, since otherwise the event is never emitted.
7470
* It's value is `true` by default.
7571
*/

0 commit comments

Comments
 (0)