From 1fd932fd30f008f0e1d183d79f11261172005f27 Mon Sep 17 00:00:00 2001 From: MagentaManifold <17zhaomingyuan@gmail.com> Date: Thu, 26 Feb 2026 14:37:40 -0500 Subject: [PATCH] fix(settings): fix metrics not always emitted for third party auth Because: * metrics not always emitted for third party auth This commit: * avoids using
for navigation Closes FXA-12949 --- packages/fxa-react/lib/utils.tsx | 7 +- .../__snapshots__/index.test.tsx.snap | 12 +- .../components/ThirdPartyAuth/index.test.tsx | 107 +++++++--------- .../src/components/ThirdPartyAuth/index.tsx | 118 ++++++++---------- 4 files changed, 106 insertions(+), 138 deletions(-) diff --git a/packages/fxa-react/lib/utils.tsx b/packages/fxa-react/lib/utils.tsx index 6ffe76177f0..1ba2f137e2d 100644 --- a/packages/fxa-react/lib/utils.tsx +++ b/packages/fxa-react/lib/utils.tsx @@ -16,7 +16,8 @@ export function hardNavigate( href: string, additionalQueryParams: Record = {}, includeCurrentQueryParams = false, - replace: boolean = false + replace: boolean = false, + timeoutMs: number = DEFAULT_NAVIGATE_TIMEOUT_MS ) { // If there are any query params in the href, we automatically include them in the new url. const url = new URL(href, window.location.origin); @@ -40,11 +41,11 @@ export function hardNavigate( if (replace) { setTimeout(() => { window.location.replace(url.href); - }, DEFAULT_NAVIGATE_TIMEOUT_MS); + }, timeoutMs); } else { setTimeout(() => { window.location.href = url.href; - }, DEFAULT_NAVIGATE_TIMEOUT_MS); + }, timeoutMs); } } diff --git a/packages/fxa-settings/src/components/ThirdPartyAuth/__snapshots__/index.test.tsx.snap b/packages/fxa-settings/src/components/ThirdPartyAuth/__snapshots__/index.test.tsx.snap index 78acdcd6cfa..19c7da56f2c 100644 --- a/packages/fxa-settings/src/components/ThirdPartyAuth/__snapshots__/index.test.tsx.snap +++ b/packages/fxa-settings/src/components/ThirdPartyAuth/__snapshots__/index.test.tsx.snap @@ -4,9 +4,9 @@ exports[`ThirdPartyAuthComponent buttons match snapshot: apple 1`] = ` - + {buttonText} + ); };