Skip to content

Commit 1c9cb11

Browse files
committed
chore: addressing cursor comment
1 parent 158db3f commit 1c9cb11

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

packages/sdk/browser/src/BrowserClient.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,18 @@ class BrowserClientImpl extends LDClientImpl {
228228
identifyOptionsWithUpdatedDefaults.sheddable = true;
229229
}
230230

231-
if (!this._identifyAttempted && identifyOptionsWithUpdatedDefaults.bootstrap) {
231+
if (!this._identifyAttempted ) {
232232
this._identifyAttempted = true;
233-
const bootstrapData = readFlagsFromBootstrap(
234-
this.logger,
235-
identifyOptionsWithUpdatedDefaults.bootstrap,
236-
);
237-
try {
238-
this.presetFlags(bootstrapData);
239-
} catch {
240-
this.logger.error('Failed to bootstrap data');
233+
if (identifyOptionsWithUpdatedDefaults.bootstrap) {
234+
try {
235+
const bootstrapData = readFlagsFromBootstrap(
236+
this.logger,
237+
identifyOptionsWithUpdatedDefaults.bootstrap,
238+
);
239+
this.presetFlags(bootstrapData);
240+
} catch (error) {
241+
this.logger.error('Failed to bootstrap data', error);
242+
}
241243
}
242244
}
243245

packages/shared/sdk-client/src/context/ensureKey.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@launchdarkly/js-sdk-common';
1111

1212
import { getOrGenerateKey } from '../storage/getOrGenerateKey';
13-
import { namespaceForGeneratedContextKey } from '../storage/namespaceUtils';
13+
import { namespaceForAnonymousGeneratedContextKey } from '../storage/namespaceUtils';
1414

1515
const { isLegacyUser, isMultiKind, isSingleKind } = internal;
1616

@@ -31,7 +31,7 @@ const ensureKeyCommon = async (kind: string, c: LDContextCommon, platform: Platf
3131
const { anonymous, key } = c;
3232

3333
if (anonymous && !key) {
34-
const storageKey = await namespaceForGeneratedContextKey(kind);
34+
const storageKey = await namespaceForAnonymousGeneratedContextKey(kind);
3535
// This mutates a cloned copy of the original context from ensureyKey so this is safe.
3636
// eslint-disable-next-line no-param-reassign
3737
c.key = await getOrGenerateKey(storageKey, platform);

0 commit comments

Comments
 (0)