Skip to content

fix: disable closing price impact modal while submitting a trade#40811

Merged
micaelae merged 1 commit intomainfrom
swaps4256-disable-close-on-submit
Mar 11, 2026
Merged

fix: disable closing price impact modal while submitting a trade#40811
micaelae merged 1 commit intomainfrom
swaps4256-disable-close-on-submit

Conversation

@micaelae
Copy link
Copy Markdown
Member

@micaelae micaelae commented Mar 11, 2026

Description

Fixes a bug in which the priceImpact modal automatically closes after tx submission, which allows re-submitting the same trade. This change disables closing the modal when the modal overlay is clicked and also removes onClose call after the transaction is submitted

Open in GitHub Codespaces

Changelog

CHANGELOG entry: fix: disable closing price impact modal while submitting a trade

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4256

Manual testing steps

  1. Get a swap quote with high price impact (small amount of ETH to MUSD usually has a PancakeSwap route)
  2. Submit the trade
  3. Try to close the modal while submission is in progress
  4. After submission, the wallet should navigate to the activity log

Screenshots/Recordings

Before

After

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.

Note

Medium Risk
Changes the bridge submission UX/control flow by keeping the price impact modal open and adjusting post-submit navigation, which could affect error handling and prevent/allow unintended resubmissions.

Overview
Prevents the BridgePriceImpactWarningModal (submit CTA variant) from being dismissed via outside click/escape during submission and removes the automatic onClose() after clicking Proceed, keeping the modal open until explicitly cancelled.

Adjusts bridge submission error handling in useSubmitBridgeTransaction by no longer immediately navigating to the Activity page from the catch block (only hardware-wallet rejections redirect back to the bridge page), and updates the modal test expectations accordingly.

Written by Cursor Bugbot for commit d434b80. This will update automatically on new commits. Configure here.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Mar 11, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 11, 2026

✨ Files requiring CODEOWNER review ✨

🔄 @MetaMask/swaps-engineers (3 files, +3 -6)
  • 📁 ui/
    • 📁 pages/
      • 📁 bridge/
        • 📁 hooks/
          • 📄 useSubmitBridgeTransaction.ts +0 -2
        • 📁 prepare/
          • 📄 bridge-price-impact-modal.test.tsx +1 -1
          • 📄 bridge-price-impact-modal.tsx +2 -3

@micaelae micaelae marked this pull request as ready for review March 11, 2026 17:32
@micaelae micaelae requested a review from a team as a code owner March 11, 2026 17:32
@sonarqubecloud
Copy link
Copy Markdown

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 11, 2026

Builds ready [d434b80]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account27025628912279289
total27025628912279289
Confirm Txconfirm_tx6020599960371560306037
total6020599960371560306037
Bridge User Actionsbridge_load_page2612502708267270
bridge_load_asset_picker17014320022181200
bridge_search_token71169172514723725
total1132108111934211631193
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14331163170111514811664
load1184962143310112301366
domContentLoaded1177957142410012241355
domInteractive2916100192678
firstPaint173661206130204333
backgroundConnect21118325313217239
firstReactRender19124442025
initialActions105123
loadScripts98376912269810301157
setupStore1474561625
numNetworkReqs352791182785
Power User HomeuiStartup5538218517869270665348968
load12861131174412113231542
domContentLoaded12681125171311112951501
domInteractive3719315363388
firstPaint1988042689267361
backgroundConnect207429014596244827156155
firstReactRender26185162834
initialActions104112
loadScripts1047922149010310861280
setupStore1556081930
numNetworkReqs1344825844145248
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2182182190219219
srpButtonToSrpForm93929309393
confirmSrpToPwForm21212102121
pwFormToMetricsScreen16151711717
metricsToWalletReadyScreen16151711617
doneButtonToHomeScreen61558466635648666
openAccountMenuToAccountListLoaded27582499294220729302942
total37403455393220138923932
Onboarding New WalletcreateWalletToSocialScreen2222182253225225
srpButtonToPwForm1131081184115118
createPwToRecoveryScreen99100910
skipBackupToMetricsScreen39384114141
agreeButtonToOnboardingSuccess17161911819
doneButtonToAssetList56251065955584659
total94090699131931991
Asset DetailsassetClickToPriceChart1429819638165196
total1429819638165196
Solana Asset DetailsassetClickToPriceChart81511011890101
total81511011890101
Import Srp HomeloginToHomeScreen24232244269916124522699
openAccountMenuAfterLogin554167106267
homeAfterImportWithNewWallet2317224123946123802394
total47954649502913848645029
Send TransactionsopenSendPageFromHome271746113646
selectTokenToSendFormLoaded19162121921
reviewTransactionToConfirmationPage9048441064938551064
total94888411291048901129
SwapopenSwapPageFromHome32244793947
fetchAndDisplaySwapQuotes268026792681126812681
total2713270327281127232728
🌐 Dapp Page Load Benchmarks

Current Commit: d434b80 | Date: 3/11/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±42ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 736ms (±40ms) 🟢 | historical mean value: 740ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±10ms) 🟢 | historical mean value: 82ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 42ms 1.02s 1.37s 1.10s 1.37s
domContentLoaded 736ms 40ms 712ms 1.04s 786ms 1.04s
firstPaint 81ms 10ms 68ms 168ms 88ms 168ms
firstContentfulPaint 81ms 10ms 68ms 168ms 88ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: -156 Bytes (0%)
  • ui: -678 Bytes (-0.01%)
  • common: 20 Bytes (0%)

@micaelae micaelae added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit be0650d Mar 11, 2026
201 of 202 checks passed
@micaelae micaelae deleted the swaps4256-disable-close-on-submit branch March 11, 2026 19:55
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2026
@metamaskbot metamaskbot added the release-13.23.0 Issue or pull request that will be included in release 13.23.0 label Mar 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.23.0 Issue or pull request that will be included in release 13.23.0 size-XS team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants