diff --git a/ui/pages/onboarding-flow/welcome/welcome.js b/ui/pages/onboarding-flow/welcome/welcome.js index 2b6c092af39a..bcd4dc8af755 100644 --- a/ui/pages/onboarding-flow/welcome/welcome.js +++ b/ui/pages/onboarding-flow/welcome/welcome.js @@ -51,11 +51,13 @@ export default function OnboardingWelcome() { const currentKeyring = useSelector(getCurrentKeyring); const firstTimeFlowType = useSelector(getFirstTimeFlowType); const [termsChecked, setTermsChecked] = useState(false); + const [newAccountCreationInProgress, setNewAccountCreationInProgress] = + useState(false); // Don't allow users to come back to this screen after they // have already imported or created a wallet useEffect(() => { - if (currentKeyring) { + if (currentKeyring && !newAccountCreationInProgress) { if (firstTimeFlowType === FirstTimeFlowType.import) { history.replace(ONBOARDING_COMPLETION_ROUTE); } @@ -65,10 +67,16 @@ export default function OnboardingWelcome() { history.replace(ONBOARDING_SECURE_YOUR_WALLET_ROUTE); } } - }, [currentKeyring, history, firstTimeFlowType]); + }, [ + currentKeyring, + history, + firstTimeFlowType, + newAccountCreationInProgress, + ]); const trackEvent = useContext(MetaMetricsContext); const onCreateClick = async () => { + setNewAccountCreationInProgress(true); dispatch(setFirstTimeFlowType(FirstTimeFlowType.create)); trackEvent({ category: MetaMetricsEventCategory.Onboarding,