Skip to content

Commit

Permalink
Fix wrong error log
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Nov 19, 2024
1 parent 6d55915 commit 8a6b67f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2.0.1 (November XX, 2024)
- Updated internal handling of the `updateOnSdkTimedout` param to remove the wrong log "[ERROR] A listener was added for SDK_READY_TIMED_OUT on the SDK, which has already fired and won't be emitted again".
- Bugfixing - Fixed an issue with the `updateOn***` object parameters of the `useSplitClient` and `useSplitTreatments` hooks, and their components and HOCs alternatives, which were not defaulting to `true` when a non-boolean value was provided.

2.0.0 (November 1, 2024)
Expand Down
8 changes: 6 additions & 2 deletions src/useSplitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ export function useSplitClient(options?: IUseSplitClientOptions): ISplitContextV
else if (!status.isReadyFromCache) update();
}
if (updateOnSdkTimedout !== false) {
if (!statusOnEffect.hasTimedout) client.once(client.Event.SDK_READY_TIMED_OUT, update);
else if (!status.hasTimedout) update();
if (!statusOnEffect.hasTimedout) {
// Required to avoid error log for event already emitted
if (!statusOnEffect.isReady) client.once(client.Event.SDK_READY_TIMED_OUT, update);
} else {
if (!status.hasTimedout) update();
}
}
if (updateOnSdkUpdate !== false) client.on(client.Event.SDK_UPDATE, update);

Expand Down

0 comments on commit 8a6b67f

Please sign in to comment.