Skip to content

Commit 4c0148e

Browse files
committed
Skip client-side redirect to /signin during sign-out
Check isSigningOut() before navigating to /signin on InvalidTokenError. During sign-out, session.destroy() triggers InvalidTokenError which caused a client-side redirect racing against the hard navigation via window.location.assign, producing a double-render.
1 parent f90a86c commit 4c0148e

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)