diff --git a/packages/experiment-tag/src/subscriptions/subscriptions.ts b/packages/experiment-tag/src/subscriptions/subscriptions.ts index 4a206fb3a..c270111a5 100644 --- a/packages/experiment-tag/src/subscriptions/subscriptions.ts +++ b/packages/experiment-tag/src/subscriptions/subscriptions.ts @@ -855,8 +855,13 @@ export class SubscriptionManager { history.pushState = function (...args) { // Call the original pushState const result = originalPushState.apply(this, args); - // Revert mutations and apply variants - handleUrlChange(); + // Defer experiment re-evaluation so the calling navigation framework + // (e.g. Angular, Vue, MFE routers) can finish its own synchronous + // navigation cycle before we apply DOM mutations. Running synchronously + // inside pushState interleaves with framework rendering and can corrupt + // component bindings (e.g. Angular async pipe receiving non-Observable + // values). + setTimeout(handleUrlChange, 0); return result; }; @@ -864,8 +869,7 @@ export class SubscriptionManager { history.replaceState = function (...args) { // Call the original replaceState const result = originalReplaceState.apply(this, args); - // Revert mutations and apply variants - handleUrlChange(); + setTimeout(handleUrlChange, 0); return result; }; };