Skip to content

refactor(popup): redirect to swap - #47605

Open
n3ps wants to merge 4 commits into
mainfrom
n3ps/remove-stay-on-home-page
Open

n3ps wants to merge 4 commits into
mainfrom
n3ps/remove-stay-on-home-page

Conversation

@n3ps

@n3ps n3ps commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

In Popup, the router redirected to Swap on EVERY navigation while quotes existed.

Navigation links had to override this with a stayOnHomePage.

Now it redirects only on the popup's first screen (location.key === 'default') so we can remove this "stayOnHomePage" override

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

  1. Open popup on Home with bridge quotes in state
  2. Navigate to Settings (or any page), verify no redirect to Swap
  3. Close and reopen popup on Home, verify redirect to Swap happens

Screenshots/Recordings

N/A

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • 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.
Open in Web Open in Cursor 

Note

Medium Risk
Changes core popup routing when bridge/batch-sell quotes exist; wrong location.key handling could skip needed redirects or leave stale quote hijacks, though behavior is covered by new and updated router tests.

Reviewed by Cursor Bugbot for commit bb6cc13. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 4 commits November 4, 2026 03:05
Replace stayOnHomePage opt-out flag with first-screen detection
(location.key === 'default') in confirmation-router.tsx. The redirect
now fires only when the popup is initially opened, not on subsequent
in-app navigation, eliminating the need for every caller to pass
stayOnHomePage: true.

Remove stayOnHomePage from all navigation calls, type definitions,
and tests (useMainNavItems, money-account-balance, useBatchSellSubmitQuotes,
useBatchSellNavigation, useBridgeNavigation).

Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
@n3ps
n3ps deployed to pr-comment November 4, 2026 03:28 — with GitHub Actions Active
@github-actions github-actions Bot added the size-M label Nov 4, 2026
@metamask-ci

metamask-ci Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/earn (2 files, +3 -9)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 money/
          • 📁 money-account-balance/
            • 📄 money-account-balance.test.tsx +2 -6
            • 📄 money-account-balance.tsx +1 -3

🔄 @MetaMask/swaps-engineers (5 files, +5 -28)
  • 📁 ui/
    • 📁 hooks/
      • 📁 bridge/
        • 📄 useBridgeNavigation.test.ts +0 -4
        • 📄 useBridgeNavigation.ts +5 -18
        • 📄 useSubmitBridgeTransaction.test.tsx +0 -4
    • 📁 pages/
      • 📁 bridge/
        • 📁 hooks/
          • 📄 useNavigateOnQrScanComplete.test.tsx +0 -1
          • 📄 index.test.tsx +0 -1

@metamask-ci metamask-ci Bot added the team-core-extension-ux Core Extension UX team label Nov 4, 2026
@n3ps
n3ps deployed to pr-comment November 4, 2026 03:42 — with GitHub Actions Active
@metamask-ci

metamask-ci Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor
Builds ready [bb6cc13]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 4 warn · 🔴 3 fail)

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 41767296647 | Baseline logs

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 3 failures)

Interaction Benchmarks · Samples: 5 🔴 2
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 [CI log]
🔴 load_new_account
🔴 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↓ loadNewAccount/inp: -10%
  • ↑ loadNewAccount/fcp: +12%
  • ↑ loadNewAccount/cls: +282%
  • ↑ confirmTx/longTaskTotalDuration: +58%
  • ↑ confirmTx/longTaskMaxDuration: +72%
  • ↑ confirmTx/tbt: +96%
  • ↑ confirmTx/fcp: +13%
  • ↑ confirmTx/lcp: +13%
  • ↑ bridgeUserActions/bridge_load_page: +68%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +111%
  • ↑ bridgeUserActions/longTaskCount: +36%
  • ↑ bridgeUserActions/longTaskTotalDuration: +45%
  • ↑ bridgeUserActions/tbt: +59%
  • ↑ bridgeUserActions/total: +21%
  • ↑ bridgeUserActions/fcp: +10%
  • ↑ bridgeUserActions/cls: +281%
  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↓ loadNewAccount/inp: -33%
  • ↓ loadNewAccount/fcp: -54%
  • ↑ loadNewAccount/lcp: +915%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -29%
  • ↓ confirmTx/fcp: -59%
  • ↑ confirmTx/lcp: +1060%
  • ↑ bridgeUserActions/bridge_load_page: +140%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +44%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +19%
  • ↑ bridgeUserActions/inp: +54%
  • ↓ bridgeUserActions/fcp: -59%
  • ↑ bridgeUserActions/lcp: +1258%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 1.9s
  • 🟡 confirmTx/FCP: p75 1.9s
  • 🟡 bridgeUserActions/FCP: p75 1.9s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 loadScripts

📈 Results compared to the previous 5 runs on main

  • ↑ startupStandardHome/domInteractive: +15%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -29%
  • ↑ startupStandardHome/setupStore: +153%
  • ↓ startupStandardHome/longTaskCount: -29%
  • ↑ startupStandardHome/cls: +400%
  • ↑ startupStandardHome/domInteractive: +41%
  • ↓ startupStandardHome/firstReactRender: -99%
  • ↓ startupStandardHome/initialActions: -50%
  • ↑ startupStandardHome/setupStore: +149%
  • ↑ startupStandardHome/fcp: +43%
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 total
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total

📈 Results compared to the previous 5 runs on main

  • ↑ onboardingImportWallet/srpButtonToSrpForm: +33%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +32%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +24%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +29%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -91%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -85%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -78%
  • ↓ onboardingNewWallet/longTaskCount: -100%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -100%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -100%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -74%
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↓ dappPageLoad/pageLoadTime: -62%
  • ↓ dappPageLoad/domContentLoaded: -22%
  • ↓ dappPageLoad/firstPaint: -42%
  • ↓ dappPageLoad/firstContentfulPaint: -42%
Bundle Size Diffs
Status Bundle Total Diff Change
✅ background 15.26 MiB +25 Bytes 0.00%
✅ ui 19.33 MiB -287 Bytes 0.00%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.44 MiB -84 Bytes 0.00%
✅ content scripts 3.23 MiB -168 Bytes 0.00%
✅ unzipped 79.64 MiB -266.4 KiB -0.33%
✅ zip 23.81 MiB -265.39 KiB -1.08%

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@n3ps n3ps added the retry-ci Tells GitHub Actions to retry failed jobs, label removed automatically before the retry label Nov 4, 2026
@n3ps
n3ps marked this pull request as ready for review November 4, 2026 04:06
@n3ps
n3ps requested review from a team as code owners November 4, 2026 04:06
@n3ps
n3ps deployed to pr-comment November 4, 2026 04:06 — with GitHub Actions Active
@n3ps
n3ps enabled auto-merge November 4, 2026 04:07
@n3ps
n3ps requested a review from a team November 4, 2026 04:07
@n3ps n3ps changed the title fix: only redirect to swap/batch sell on popup first screen refactor: redirect to swap Nov 4, 2026
@n3ps n3ps changed the title refactor: redirect to swap refactor: replace stayOnHomePage Nov 4, 2026
@n3ps n3ps changed the title refactor: replace stayOnHomePage refactor: redirect to swap Nov 4, 2026
@n3ps n3ps changed the title refactor: redirect to swap refactor(popup): redirect to swap Nov 4, 2026

This branch had an error being deployed

1 failed and 1 active deployments
segment-schema — bb6cc136 Deployed Nov 4, 2026 by n3ps via propose #2938
pr-comment — bb6cc136 Deployed Nov 4, 2026 by n3ps via identify-codeowners #88408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

retry-ci Tells GitHub Actions to retry failed jobs, label removed automatically before the retry size-M team-core-extension-ux Core Extension UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants