metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

fix: updates transaction details page with router v6 hooks

Open ghgoodreau opened this issue 1 month ago • 4 comments

Description

The swap/bridge transaction details page was broken after the React Router v5 → v6 migration. Clicking on a swap transaction in the activity list would show an empty details page with a broken back button.

Root cause: The CrossChainSwapTxDetails component was still expecting params, location, and navigate as props (v5 pattern), but the router migration in e14532f7bf changed how route components receive these - they now need to use hooks (useParams, useLocation, useNavigate).

Fix: Updated the component to use React Router v6 hooks instead of props, and updated the corresponding tests to mock the hooks.

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed swap/bridge transaction details page not loading when clicking on a transaction from the activity list

Related issues

Fixes: https://github.com/MetaMask/metamask-extension/issues/38682

Manual testing steps

  1. Go to the Bridge page and perform a swap (e.g., ETH to USDC)
  2. Wait for the transaction to complete
  3. Go to the Activity tab
  4. Click on the completed swap transaction
  5. Verify the transaction details page loads correctly with all info (status, amounts, gas fee, nonce, etc.)
  6. Verify the back button works

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] Migrates CrossChainSwapTxDetails to use React Router v6 hooks and updates tests, restoring correct rendering and navigation for bridge/swap transaction details.

  • UI (Bridge Transaction Details):
    • Refactor ui/pages/bridge/transaction-details/transaction-details.tsx to use useParams, useLocation, and useNavigate (remove props-based location, navigate, params).
    • Read transactionGroup and isEarliestNonce from location.state; use navigate(PREVIOUS_ROUTE) for back action.
  • Tests:
    • Update transaction-details.test.tsx to mock useNavigate, useLocation, useParams and render <CrossChainSwapTxDetails /> without props.
    • Maintain snapshot/row assertions across completed, pending, confirmed, and failed states.

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

ghgoodreau avatar Dec 09 '25 21:12 ghgoodreau

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.

github-actions[bot] avatar Dec 09 '25 21:12 github-actions[bot]

✨ Files requiring CODEOWNER review ✨

🔄 @MetaMask/swaps-engineers (2 files, +37 -63)
  • 📁 ui/
    • 📁 pages/
      • 📁 bridge/
        • 📁 transaction-details/
          • 📄 transaction-details.test.tsx +32 -47
          • 📄 transaction-details.tsx +5 -16

metamaskbot avatar Dec 09 '25 21:12 metamaskbot

Builds ready [3c58f95]
UI Startup Metrics (1269 ± 121 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12691033167612113331463
load1039856134210211031240
domContentLoaded1032852132610110981234
domInteractive261699202287
firstPaint4789113443829891172
backgroundConnect21319425012220239
firstReactRender4431151154967
getState3817144204269
initialActions103112
loadScripts8266561123978801030
setupStore1263651321
numNetworkReqs1367519669
BrowserifyPower User HomeuiStartup19141543255316119792197
load1074870155613111881250
domContentLoaded1063862154913111731242
domInteractive3217236302796
firstPaint53595125039810011214
backgroundConnect24519861189232539
firstReactRender46366354854
getState19014272577189255
initialActions102112
loadScripts85366513151289671039
setupStore1684071434
numNetworkReqs72591461968128
WebpackStandard HomeuiStartup829687122891873990
load669576103382708816
domContentLoaded663571101580702808
domInteractive2815122222399
firstPaint24581821171224690
backgroundConnect1255681330
firstReactRender53341692957140
getState281468103745
initialActions102112
loadScripts659569100679700805
setupStore1162741419
numNetworkReqs1468320674
WebpackPower User HomeuiStartup14301091203719016061734
load7366011029106838904
domContentLoaded7295931022105829896
domInteractive32171622826109
firstPaint321991031250342901
backgroundConnect89667217249569
firstReactRender50428165262
getState18814333337204267
initialActions102112
loadScripts7265901013104825894
setupStore18740101937
numNetworkReqs72582222568134
FirefoxBrowserifyStandard HomeuiStartup13271060219421214331719
load1069900197116711281249
domContentLoaded1068899197116711281249
domInteractive783198013384150
firstPaint------
backgroundConnect57213075470190
firstReactRender37309393954
getState157155211136
initialActions102012
loadScripts1041884192615911011190
setupStore16597181161
numNetworkReqs1668922875
BrowserifyPower User HomeuiStartup26531665381953030813372
load1631986246949421352383
domContentLoaded1630986246949421352382
domInteractive222321072329230975
firstPaint------
backgroundConnect205251069228232930
firstReactRender5436100125983
getState1297127242159215
initialActions2042423
loadScripts1546970244846319842309
setupStore515104214638147
numNetworkReqs74531342170126
WebpackStandard HomeuiStartup15951336237220317031943
load13081118183012713711556
domContentLoaded13081118183012713711556
domInteractive70291673590132
firstPaint------
backgroundConnect62203334773147
firstReactRender443394104961
getState177196241748
initialActions103122
loadScripts12761099176511913391514
setupStore206153271495
numNetworkReqs1668522878
WebpackPower User HomeuiStartup26201712402159030643529
load18641165350052523002526
domContentLoaded18631158350052523002525
domInteractive251291288370230997
firstPaint------
backgroundConnect159201106203204434
firstReactRender5435121135980
getState1296425544150231
initialActions2036427
loadScripts17881107271748422452495
setupStore2641913227116
numNetworkReqs76571372184129
📊 Page Load Benchmark Results

Current Commit: 3c58f95 | Date: 12/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±52ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 731ms (±50ms) 🟢 | historical mean value: 727ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±12ms) 🟢 | historical mean value: 83ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 52ms 1.02s 1.34s 1.09s 1.34s
domContentLoaded 731ms 50ms 701ms 996ms 761ms 996ms
firstPaint 78ms 12ms 60ms 188ms 88ms 188ms
firstContentfulPaint 78ms 12ms 60ms 188ms 88ms 188ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 79 Bytes (0%)
  • ui: 44 Bytes (0%)
  • common: 44 Bytes (0%)

metamaskbot avatar Dec 09 '25 22:12 metamaskbot

Builds ready [c2460f3]
UI Startup Metrics (1247 ± 106 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12471026160810612991434
load102886213339210721204
domContentLoaded102185313279210661197
domInteractive2515103182273
firstPaint4527812133769661121
backgroundConnect21219326814215246
firstReactRender453174115169
getState3919143164861
initialActions104112
loadScripts818655109187854998
setupStore1364861425
numNetworkReqs1367918671
BrowserifyPower User HomeuiStartup18931468243218720102225
load1021857163513111021245
domContentLoaded1009849162312910761238
domInteractive2916123232595
firstPaint67185164342210431202
backgroundConnect249181727111228582
firstReactRender49389395375
getState1957072664208258
initialActions103112
loadScripts80965614021258761029
setupStore1486171433
numNetworkReqs70501371867121
WebpackStandard HomeuiStartup834680116083901964
load66756886076719821
domContentLoaded66256285076715809
domInteractive261699192379
firstPaint22886798145236612
backgroundConnect1264381332
firstReactRender57342453855135
getState311493144153
initialActions103112
loadScripts65855784775713806
setupStore1273051421
numNetworkReqs1468520673
WebpackPower User HomeuiStartup14541055207520716371758
load746591979110864923
domContentLoaded738585970109856913
domInteractive31171392626109
firstPaint29596918222291870
backgroundConnect1147648193109584
firstReactRender50418975262
getState18714330535194263
initialActions103112
loadScripts735583957108853910
setupStore16646101638
numNetworkReqs71571432267137
FirefoxBrowserifyStandard HomeuiStartup13611095252721914551667
load1097905222317211441304
domContentLoaded1097900222317211441304
domInteractive7531127512686136
firstPaint------
backgroundConnect52221793469117
firstReactRender38316574056
getState137131151226
initialActions103112
loadScripts1067890220716811121244
setupStore156109191163
numNetworkReqs1568521874
BrowserifyPower User HomeuiStartup26591627380354430983361
load1676980259650221272386
domContentLoaded1676979259550221272386
domInteractive13433136722292897
firstPaint------
backgroundConnect190261151225193970
firstReactRender5735186186092
getState1347932343157220
initialActions2036423
loadScripts1580959254247020112281
setupStore475103811346206
numNetworkReqs74521352084123
WebpackStandard HomeuiStartup15821288218019816602048
load13081113195213113891519
domContentLoaded13071113195213113891519
domInteractive782218037107133
firstPaint------
backgroundConnect57192254174134
firstReactRender41339994453
getState186202281551
initialActions102122
loadScripts12761082192612313541485
setupStore185128221575
numNetworkReqs1568921876
WebpackPower User HomeuiStartup25991738393150429733305
load18301134269544122182443
domContentLoaded18301134269544122182443
domInteractive1522699925988945
firstPaint------
backgroundConnect14524981158184282
firstReactRender543588105977
getState1387595193158230
initialActions2037427
loadScripts17541117259442421202372
setupStore405104911228120
numNetworkReqs75531392282129
📊 Page Load Benchmark Results

Current Commit: c2460f3 | Date: 12/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±41ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 718ms (±38ms) 🟢 | historical mean value: 727ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±13ms) 🟢 | historical mean value: 83ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 41ms 1.01s 1.33s 1.06s 1.33s
domContentLoaded 718ms 38ms 699ms 995ms 736ms 995ms
firstPaint 76ms 13ms 60ms 192ms 84ms 192ms
firstContentfulPaint 76ms 13ms 60ms 192ms 84ms 192ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 79 Bytes (0%)
  • ui: 44 Bytes (0%)
  • common: 44 Bytes (0%)

metamaskbot avatar Dec 10 '25 03:12 metamaskbot