Skip to content

Commit 5e4eb9b

Browse files
authored
Merge pull request #20051 from mozilla/fix-signout-double-render
Skip client-side redirect to /signin during sign-out
2 parents 30e2ded + 4c0148e commit 5e4eb9b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • packages/fxa-settings/src/components/Settings

packages/fxa-settings/src/components/Settings/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { SETTINGS_PATH } from '../../constants';
3535
import PageAvatar from './PageAvatar';
3636
import PageRecentActivity from './PageRecentActivity';
3737
import { MfaGuardPageRecoveryKeyCreate } from './PageRecoveryKeyCreate';
38-
import { currentAccount, sessionToken } from '../../lib/cache';
38+
import { currentAccount, isSigningOut, sessionToken } from '../../lib/cache';
3939
import { hasAccount, setCurrentAccount } from '../../lib/storage-utils';
4040
import GleanMetrics from '../../lib/glean';
4141
import Head from 'fxa-react/components/Head';
@@ -131,9 +131,12 @@ export const Settings = ({
131131

132132
// This error check includes a network error
133133
if (error) {
134-
// If the session token is invalid (destroyed/expired), redirect to signin
134+
// If the session token is invalid, redirect to signin.
135+
// Skip during sign-out to avoid racing with window.location.assign.
135136
if (error instanceof InvalidTokenError) {
136-
navigateWithQuery('/signin');
137+
if (!isSigningOut()) {
138+
navigateWithQuery('/signin');
139+
}
137140
return <LoadingSpinner fullScreen />;
138141
}
139142
Sentry.captureException(error, { tags: { source: 'settings' } });

0 commit comments

Comments
 (0)