Repository navigation
fix(swaps): stay in swaps after transaction submission - #47591
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (4 files, +135 -4)
🧪 @MetaMask/qa (3 files, +13 -9)
🔄 @MetaMask/swaps-engineers (8 files, +104 -60)
|
Builds ready [9190149]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 3 warn · 🔴 3 fail)
Bundle Size Diffs
|
# Conflicts: # ui/hooks/bridge/useSubmitBridgeTransaction.test.tsx
86f2933
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 86f2933. Configure here.
Builds ready [86f2933]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 3 warn · 🔴 3 fail)
Bundle Size Diffs
|
…eld after hardware wallet signing
Builds ready [3dc7a81]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 5 warn · 🔴 3 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
# Conflicts: # test/e2e/page-objects/pages/bridge/quote-page.ts
Builds ready [c79cf8d]
⚡ Performance Benchmarks (Total: 🟢 9 pass · 🟡 0 warn · 🔴 4 fail)
Bundle Size Diffs
|
|
|
No release label on PR. Adding release label release-13.58.0 on PR, as PR was added to branch 13.58.0 when release was cut. |




Description
After submitting any swap or bridge, users were sent back to the Home page. They now stay in Swaps, with the token pair kept and the amount cleared so the submitted quote can't be resubmitted.
Each submit path is handled where it happens:
useSubmitBridgeTransaction): there's no navigation. On success the amount is cleared and the user stays on the Swaps page. A failed submit leaves the page and amount untouched.useHwSwapNavigation): the signing page is opened on top of Swaps. After signing, the hook clears the amount, resets the bridge controller and goes back one history entry. The reset must happen before going back, because the remounted Swaps page restores the amount from the controller's active quote. The token pair is unaffected, since it lives in the Redux bridge slice rather than the controller.Transaction Shield:
mainthey went Home, because the signing page's URL dropped theisFromTransactionShieldparam.navigateToHwSigningPagenow carries that param over, so post-signing navigation returns to Shield.Unchanged behaviour:
sendBundle) still go Home.Analytics side effect:
Input Changedevents fire changes for users who leave Swaps with Back after submitting. Back resets the bridge controller, which it always has. When Swaps is reopened, the source token is already the default (native), so achain_sourceevent fires instead oftoken_source. The e2e expectation intest/e2e/tests/bridge/constants.ts(resetPage) is updated to match.Test changes:
goBackAfterSubmit()page-object step waits for the amount to clear, which confirms the new behaviour, then presses Back to reach Home before the Activity checks. It is called from the sharedverifySubmittedSwapTransactionflow and from the specs that submit directly: gasless, bridge failure cases, BTC, Solana, smart transactions and Ledger. The "View activity" clicks andclickViewActivitywere removed because that status page is no longer shown.Changelog
CHANGELOG entry: Users now stay on the Swaps page after submitting a swap or bridge, instead of being sent to the Home page
Related issues
Fixes: SWAPS-5212
Manual testing steps
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches core swap submission navigation for software and hardware wallets plus Transaction Shield routing, so regressions could strand users on wrong screens; mitigated by broad unit/e2e updates but still warrants careful QA.
Overview
Navigation + submission flow tweaks
navigateToHwSigningPagethreads theisFromTransactionShieldquery param through hardware wallet signing URLs, and hardware-wallet post-signing navigation differentiates send-bundle, Shield, and standard histories (resetting the bridge controller or popping history as needed while clearing amounts).Tests & tooling
goBackAfterSubmitand update bridge/swap e2e suites (gasless, BTC, Solana, smart transactions, ledger, negative cases, shared flows) to wait for a cleared amount before backing out, assert smart-tx toasts, refresh analytics expectations, and drop the obsolete “View activity” path.useBridgeNavigation,useSubmitBridgeTransaction, anduseHwSwapNavigationto cover the new navigation matrix.This is a behavior change across swap submission UX and hardware-wallet routing; mostly covered by updated unit/e2e tests but regression risk remains if any edge navigation path is missing coverage.
Reviewed by Cursor Bugbot for commit c79cf8d. Bugbot is set up for automated code reviews on this repo. Configure here.