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 }