-
Notifications
You must be signed in to change notification settings - Fork 5.4k
refactor: use const for navigate(-1) and navigate('/'); also migrate the remaining files to v5-compat #37819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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 (6 files, +38 -32)
👨🔧 @MetaMask/core-extension-ux (7 files, +24 -20)
💎 @MetaMask/metamask-assets (1 files, +5 -2)
🔔 @MetaMask/notifications (1 files, +0 -10)
|
ui/helpers/higher-order-components/with-router-hooks/with-router-hooks.tsx
Show resolved
Hide resolved
Builds ready [66acd3c]
UI Startup Metrics (1269 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [b0a310d]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
b0a310d to
12736f7
Compare
Builds ready [12736f7]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [202a374]
UI Startup Metrics (1256 ± 106 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
996910f to
95d2990
Compare
60385bd to
8ea37a4
Compare
| id-token: write # required for s3 uploads | ||
|
|
||
| jobs: | ||
| identify-builds: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing permission prevents downloading artifacts from other runs
The workflow defines explicit permissions, which sets unspecified scopes like actions to none. The new builds-from-run feature uses download-artifact to fetch artifacts from other runs, which specifically requires actions: read permission. Without adding this permission, the download steps will fail with a 403 Forbidden error when reusing builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be valid anymore since there's no changes around this file.
Builds ready [60385bd]
UI Startup Metrics (1263 ± 101 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
c9d3ed0 to
e7b43fa
Compare
| if (!rpcPrefs.blockExplorerUrl && isCustomNetwork) { | ||
| onClose(); | ||
| history.push(`${NETWORKS_ROUTE}#blockExplorerUrl`); | ||
| navigate(`${NETWORKS_ROUTE}#blockExplorerUrl`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Crash in TransactionListItemDetails due to missing navigate
The TransactionListItemDetails component has been updated to use the navigate prop instead of history, but its parent component TransactionListItem (which is not in the diff and thus presumably unchanged) has not been updated to pass this prop. This will result in a runtime error when users click the block explorer link, as navigate will be undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component is already correctly wrapped with withRouterHooks and will receive the navigate prop. The bug was likely fixed earlier in the migration. No changes needed :)
| if (!rpcPrefs.blockExplorerUrl && isCustomNetwork) { | ||
| onClose(); | ||
| history.push(`${NETWORKS_ROUTE}#blockExplorerUrl`); | ||
| navigate(`${NETWORKS_ROUTE}#blockExplorerUrl`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: TransactionListItemDetails crashes due to missing navigate prop
The TransactionListItemDetails class component was updated to expect a navigate prop instead of history, but it is not wrapped with withRouterHooks nor is its parent (TransactionListItem, which is not in the diff) updated to pass this prop. This will cause a runtime error when attempting to navigate to the block explorer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component is already correctly wrapped with withRouterHooks and will receive the navigate prop. The bug was likely fixed earlier in the migration. No changes needed :)
c49eb16 to
b280e6b
Compare
Builds ready [b280e6b]
UI Startup Metrics (1228 ± 88 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
b280e6b to
352b27f
Compare
Builds ready [80bd842]
UI Startup Metrics (1229 ± 91 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
80bd842 to
a8b9d19
Compare
a8b9d19 to
20d2209
Compare
Builds ready [20d2209]
UI Startup Metrics (1230 ± 103 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
a4e92b2 to
43c5cc0
Compare
Builds ready [43c5cc0]
UI Startup Metrics (1246 ± 100 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
43c5cc0 to
3cf79a6
Compare
Builds ready [3cf79a6]
UI Startup Metrics (1264 ± 113 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
3cf79a6 to
f66a0a2
Compare
Builds ready [f66a0a2]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
f66a0a2 to
6d381a4
Compare
Builds ready [6d381a4]
UI Startup Metrics (1293 ± 104 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Changelog
CHANGELOG entry: null
Related issues
Fixes: partial is for https://github.com/MetaMask/MetaMask-planning/issues/6231
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Finish router migration by replacing history with navigate across the app, standardizing back-nav via PREVIOUS_ROUTE, and wiring v5-compat navigation/params into routes, components, hooks, and tests.
historywithnavigateacross components (Alerts, SRP quiz, modals, popovers, send/confirm flows, bridge, snaps, permissions, home, settings, asset views, NFT image, etc.).PREVIOUS_ROUTEinstead ofnavigate(-1).withRouterHooksHOC to injectnavigate/location/params.routes.component.tsxwithcreateV5CompatRoute, passnavigate/location/paramsto lazy routes, and adaptAlerts/AccountDetailsusage.react-router-dom-v5-compat(useLocation,useMatch,matchPath).utils.jsroute matching to v5-compat (endinstead ofexact).swaps:signAndSendTransactionsnow takesnavigate; navigation routes updated.permissions-page: convert to default export.rewards(extraneous blanks removed).render-helpers-navigate, mockuseNavigate, and expectPREVIOUS_ROUTE/DEFAULT_ROUTEnavigations.navigatewhere required and use v5-compatMemoryRouter.Written by Cursor Bugbot for commit 6d381a4. This will update automatically on new commits. Configure here.