Skip to content

Commit

Permalink
PR review change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Chu committed Sep 22, 2023
1 parent 0bb360b commit 0846634
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,14 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
this.isClientReady = true;
});

this.dataReadyPromise = Promise.all([this.userPromise, this._client?.onReady()]).then(() => {
// Client and user can become ready synchronously and/or asynchronously. This flag specifically indicates that they became ready asynchronously.
this.dataReadyPromise = Promise.all([this.userPromise, this._client?.onReady()]).then(([userRes, clientRes]) => {
const bothReady = userRes.success && clientRes.success;
this.isReadyPromiseFulfilled = true;
return {
success: true,
message: 'Successfully resolved datafile and user information.',
success: bothReady,
message: bothReady
? 'Successfully resolved user information and client datafile.'
: 'User information or client datafile was not not ready.',
};
});
} else {
Expand Down

0 comments on commit 0846634

Please sign in to comment.