metamask-extension
metamask-extension copied to clipboard
refactor: routes.component.js and creation of ToastMaster
Description
This PR is part of the larger effort to add React.lazy
to routes.
I would be very surprised if I did not break functionality somewhere, as this was a large and tough refactor. It needs some good QA, and Harika has been doing some testing that has passed.
Summary of what I did:
- Pulled all Toast-related logic out of routes.component.js and into the new ToastMaster
- Pulled everything else I could pull out into routes-helpers.js
- Moved things out of the general selectors.js and actions.ts into toast-master-selectors.ts
- Simplification of some Pointless Thunks™
For later PRs:
- Convert routes.component.js to TypeScript
- Convert routes.component.js to Hooks
- Convert routes.component.js to react-router v6
- Eliminate routes.container.js
Related issues
Progresses: MetaMask/MetaMask-planning#2898
Manual testing steps
Test all the Routes and all the Toasts
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I've followed MetaMask Contributor Docs and MetaMask Extension Coding Standards.
- [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 format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). 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.