Skip to content

Commit

Permalink
[FSSDK-10730] isClientReady logic adjustment (#285)
Browse files Browse the repository at this point in the history
React SDK sets client.isClientReady property to true immediately if datafile presents in the config, before projectConfigManager gets ready, which should not be the case.
  • Loading branch information
junaed-optimizely authored Oct 4, 2024
1 parent 1197fb2 commit f3185b7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
});

this._client = optimizely.createInstance(configWithClientInfo);
this.isClientReady = !!configWithClientInfo.datafile;
this.isClientReady = !!this.getOptimizelyConfig();
this.isUsingSdkKey = !!configWithClientInfo.sdkKey;

if (this._client) {
Expand All @@ -250,8 +250,7 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
([userResult, clientResult]) => {
this.isClientReady = clientResult.success;
this.isUserReady = userResult.success;
const clientAndUserReady = this.isClientReady && this.isUserReady;

const clientAndUserReady = this.isReady();
this.clientAndUserReadyPromiseFulfilled = true;

return {
Expand Down

1 comment on commit f3185b7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest Coverage Report

St.
Category Percentage Covered / Total
🟢 Statements 98.95% 847/856
🟢 Branches 91.6% 338/369
🟢 Functions 97.52% 157/161
🟢 Lines 99.09% 765/772

Test suite run success

258 tests passing in 10 suites.

Report generated by 🧪jest coverage report action from f3185b7

Please sign in to comment.