Skip to content

Commit 2e8d577

Browse files
smgvchaitanyapotti
andauthored
fix: updated routes for backup srp settings cp-13.12.0 (#38544)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR updates the navigation routes in the onboarding flow to track when users access privacy settings from the "Manage default settings" reminder on the wallet creation successful page. The problem was in the onboarding flow redirection logic. Looking at onboarding-flow.tsx: ` useEffect(() => { if (completedOnboarding && !isFromReminder && !openedWithSidepanel) { navigate(DEFAULT_ROUTE); } }, [navigate, completedOnboarding, isFromReminder, openedWithSidepanel]); ` Issue: - When a user already completed onboarding clicks "Manage default settings" on the wallet creation successful page - They would navigate to the Privacy Settings page - BUT the isFromReminder query param was NOT being passed - The onboarding-flow.tsx would detect: - completedOnboarding = true ✅ - isFromReminder = false ❌ (missing!) - This triggered the redirect: navigate(DEFAULT_ROUTE) — kicking users out of the settings flow The Fix: The fix ensures the isFromReminder=true query parameter is: - Added when navigating from "Creation Successful" → "Privacy Settings" - Preserved when navigating from "Privacy Settings" → "Completion Route" Before: Users clicking "Manage default settings" would get unexpectedly redirected away and couldn't complete configuring their privacy settings. After: Users can properly navigate through the "Manage default settings" flow without being kicked out. Jira Link: https://consensyssoftware.atlassian.net/browse/SL-367 [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38544?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/5cd6a3e3-e812-4cb9-be04-e3a06951e6f9 ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Preserves the `isFromReminder=true` query param from Creation Successful → Privacy Settings → Completion to avoid unintended redirects for post-onboarding reminders. > > - **Onboarding flow**: > - Pass `?isFromReminder=true` when navigating from `ui/pages/onboarding-flow/creation-successful/creation-successful.tsx` to `ONBOARDING_PRIVACY_SETTINGS_ROUTE`. > - In `ui/pages/onboarding-flow/privacy-settings/privacy-settings.tsx`, read `isFromReminder` via `useLocation` and conditionally navigate to `ONBOARDING_COMPLETION_ROUTE` with the same query param to preserve context. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 017d396. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Chaitanya Potti <[email protected]>
1 parent 8a2cf93 commit 2e8d577

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

ui/pages/onboarding-flow/creation-successful/creation-successful.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ export default function CreationSuccessful() {
113113
data-testid="manage-default-settings"
114114
borderRadius={BorderRadius.LG}
115115
width={BlockSize.Full}
116-
onClick={() => navigate(ONBOARDING_PRIVACY_SETTINGS_ROUTE)}
116+
onClick={() =>
117+
navigate(`${ONBOARDING_PRIVACY_SETTINGS_ROUTE}?isFromReminder=true`)
118+
}
117119
>
118120
<Box display={Display.Flex} alignItems={AlignItems.center}>
119121
<Icon

ui/pages/onboarding-flow/privacy-settings/privacy-settings.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useContext, useState } from 'react';
22
import { useDispatch, useSelector } from 'react-redux';
3-
import { useNavigate } from 'react-router-dom-v5-compat';
3+
import { useLocation, useNavigate } from 'react-router-dom-v5-compat';
44
import classnames from 'classnames';
55
import log from 'loglevel';
66
// TODO: Remove restricted import
@@ -143,6 +143,10 @@ export default function PrivacySettings() {
143143

144144
const isBackupAndSyncEnabled = useSelector(selectIsBackupAndSyncEnabled);
145145

146+
const { search } = useLocation();
147+
const searchParams = new URLSearchParams(search);
148+
const isFromReminder = searchParams.get('isFromReminder');
149+
146150
const handleSubmit = () => {
147151
dispatch(setUse4ByteResolution(turnOn4ByteResolution));
148152
dispatch(setUseTokenDetection(turnOnTokenDetection));
@@ -173,7 +177,13 @@ export default function PrivacySettings() {
173177
turnon_token_detection: turnOnTokenDetection,
174178
},
175179
});
176-
navigate(ONBOARDING_COMPLETION_ROUTE, { replace: true });
180+
if (isFromReminder) {
181+
navigate(`${ONBOARDING_COMPLETION_ROUTE}?isFromReminder=true`, {
182+
replace: true,
183+
});
184+
} else {
185+
navigate(ONBOARDING_COMPLETION_ROUTE, { replace: true });
186+
}
177187
};
178188

179189
const handleIPFSChange = (url: string) => {

0 commit comments

Comments
 (0)