Skip to content

Commit 71a20ce

Browse files
committed
chore: addressing minor comments
1 parent 6445e26 commit 71a20ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/sdk/browser/src/BrowserClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,17 @@ class BrowserClientImpl extends LDClientImpl {
245245
// by the time the promise was rejected, then that would result in an unhandled promise
246246
// rejection.
247247

248+
// If initialization has already completed (successfully or failed), return the result immediately
249+
if (this._initializeResult) {
250+
return Promise.resolve(this._initializeResult);
251+
}
252+
248253
// It waitForInitialization was previously called, then we can use that promise even if it has
249254
// been resolved or rejected.
250255
if (this._initializedPromise) {
251256
return this._promiseWithTimeout(this._initializedPromise, timeout);
252257
}
253258

254-
// If initialization has already completed (successfully or failed), return the result immediately
255-
if (this._initializeResult) {
256-
return Promise.resolve(this._initializeResult);
257-
}
258-
259259
if (!this._initializedPromise) {
260260
this._initializedPromise = new Promise((resolve) => {
261261
this._initResolve = resolve;

0 commit comments

Comments
 (0)