-
Notifications
You must be signed in to change notification settings - Fork 5.3k
refactor: Migrate <Routes />
to react-router
v6
#35030
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
Draft
MajorLift
wants to merge
26
commits into
main
Choose a base branch
from
jongsun/react-router/refactor/250812-migrate-routes-to-react-router-v6
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
refactor: Migrate <Routes />
to react-router
v6
#35030
MajorLift
wants to merge
26
commits into
main
from
jongsun/react-router/refactor/250812-migrate-routes-to-react-router-v6
+852
−827
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
7 tasks
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
github-merge-queue bot
pushed a commit
that referenced
this pull request
Aug 13, 2025
…#33276) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## Note for Reviewers The bulk of the changes in this PR are in [`ui/pages/routes/routes.component.tsx`](https://github.com/MetaMask/metamask-extension/pull/33276/files#diff-41292899566e5a4241f4b8297aeb1a00057fc694d72ff12a3d9b7102252f59dd). Unfortunately, GitHub is failing to recognize that this file was renamed from [`ui/pages/routes/routes.component.js`](https://github.com/MetaMask/metamask-extension/pull/33276/files#diff-10975e6333c4f017e6def2e4c715c3efd9a92c87f9fa24f105598f101ad66738), even with a `git mv` commit establishing this fact: 1f91b8c. - For a side-by-side diff of the two files, you can go to https://www.diffchecker.com/eITwpTzt/ or https://diffy.org/diff/d177f182ccb97. - This issue is also contributing to the PR exceeding our maximum LoC limit, because all of the lines in `routes.component.tsx` file (751 lines) are being counted as additions, instead of just the changed lines (454 lines). ## **Motivation** The `<Routes />` component handles routing and navigation between our application's pages and url paths. Despite its importance, it remains written in JavaScript as a class component, and relies on a HOC for access to Redux state properties and actions, all of which are outdated patterns. ## **Description** This commit achieves the following: 1. Migrate `<Routes />` into a functional component that uses hooks, and can directly interface with the Redux store using selectors and dispatched actions. 2. Migrate `<Routes />` to strict TypeScript. 3. Adds `useAppSelector`, a typed version of the `useSelector` hook, to `ui/store/store.ts`. These changes represent a significant improvement in maintainability, type safety, and future extensibility. This migration also unblocks the `react-router` v6 upgrade effort, which requires class components to be converted to functional components. ## **Related issues** - Requirement for [react-router v6 upgrade](MetaMask/MetaMask-planning#3261) - ~See #31459 - Contributes to MetaMask/MetaMask-planning#5477 - Closes MetaMask/MetaMask-planning#5478 - Followed by #35030 ## **Manual testing steps** 1. After installing, check whether all steps of the onboarding flow load and display without issue. 2. Verify that pages (e.g. Settings) load and display without issue. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
Base automatically changed from
chore/react-router-v6/250515-convert-Routes-to-function-component
to
main
August 13, 2025 03:05
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Changelog
CHANGELOG entry:
Related issues
<Routes />
into a TypeScript functional component #33276Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist