Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/web/src/pages/sign-in-page/ConfirmEmailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
11 changes: 10 additions & 1 deletion packages/web/src/pages/sign-on-page/SignOnPage.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 <Navigate to={completionRoute || FEED_PAGE} />
}

Expand Down
Loading