Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Preventing a routechange to the Metametrics Onboarding page on wallet creation #25344

Merged
merged 2 commits into from
Jun 21, 2024
Merged
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
12 changes: 10 additions & 2 deletions ui/pages/onboarding-flow/welcome/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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,
Expand Down