From 6cf2ffb863b727dddb63f24b23b5a60b29468f1e Mon Sep 17 00:00:00 2001 From: Dylan Audius Date: Fri, 23 Oct 2026 16:52:24 -0700 Subject: [PATCH] fix(web): stop sign-in with an email code from landing back on /signin After a sign-in that needed an email code, the sign-on saga resets the form status right after success. The navigation to the completion route is often still pending at that point (it suspends on lazy pages), so the sign-on page rendered the form again. That remounted the sign-in routes, whose first-mount redirect from /signin/confirm-email to /signin cancelled the navigation. The user was signed in but left on the form. Keep redirecting once sign-on has succeeded. Also stop the email code page from marking a plain sign-in as a sign-up, which opened the sign-up welcome modal. Co-Authored-By: Claude Opus 5.5 --- .../web/src/pages/sign-in-page/ConfirmEmailPage.tsx | 8 ++++++-- packages/web/src/pages/sign-on-page/SignOnPage.tsx | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/web/src/pages/sign-in-page/ConfirmEmailPage.tsx b/packages/web/src/pages/sign-in-page/ConfirmEmailPage.tsx index ccf4db781a2..add8cb961f0 100644 --- a/packages/web/src/pages/sign-in-page/ConfirmEmailPage.tsx +++ b/packages/web/src/pages/sign-in-page/ConfirmEmailPage.tsx @@ -51,10 +51,14 @@ export const ConfirmEmailPage = () => { const sanitizedOtp = otp.replace(/\s/g, '') dispatch(setValueField('otp', sanitizedOtp)) dispatch(setValueField('email', email)) - dispatch(startSignUp()) + // Only guests finish sign-up from here. For everyone else this would + // open the sign-up welcome modal after a plain sign-in. + if (isGuest) { + dispatch(startSignUp()) + } dispatch(signIn(email, password, sanitizedOtp)) }, - [dispatch, email, password] + [dispatch, email, password, isGuest] ) return ( diff --git a/packages/web/src/pages/sign-on-page/SignOnPage.tsx b/packages/web/src/pages/sign-on-page/SignOnPage.tsx index a1646fda6d3..657ca3ad4a8 100644 --- a/packages/web/src/pages/sign-on-page/SignOnPage.tsx +++ b/packages/web/src/pages/sign-on-page/SignOnPage.tsx @@ -1,4 +1,4 @@ -import { ReactNode, useEffect, useLayoutEffect } from 'react' +import { ReactNode, useEffect, useLayoutEffect, useRef } from 'react' import { SystemAppearance } from '@audius/common/models' import { FEED_PAGE } from '@audius/common/src/utils/route' @@ -318,7 +318,16 @@ export const SignOnPage = () => { const location = useLocation() const isSignUp = location.pathname.startsWith(SIGN_UP_PAGE) + // The sign-on saga resets status to editing right after success, often + // before the navigation to the completion route commits (it suspends on + // lazy pages). Rendering the form again would remount the sign-in routes, + // and their first-mount redirect to /signin would cancel that navigation. + const hasSucceededRef = useRef(false) if (signOnStatus === EditingStatus.SUCCESS) { + hasSucceededRef.current = true + } + + if (hasSucceededRef.current) { return }