Skip to content

Commit 8da53ab

Browse files
CopilotMSNev
andcommitted
Fix cookie flushing order issue in setEnabled() method
Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com>
1 parent d4557a7 commit 8da53ab

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

shared/AppInsightsCore/src/JavaScriptSDK/CookieMgr.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,10 @@ export function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosti
317317
return enabled;
318318
},
319319
setEnabled: (value: boolean) => {
320+
// Update the config first to trigger onConfigChange with correct wasEnabled state
321+
cookieMgrConfig.enabled = value;
320322
// Explicitly checking against false, so that setting to undefined will === true
321323
_enabled = value !== false;
322-
cookieMgrConfig.enabled = value;
323324
},
324325
set: (name: string, value: string, maxAgeSec?: number, domain?: string, path?: string) => {
325326
let result = false;

0 commit comments

Comments
 (0)