Skip to content

Commit 22d9f91

Browse files
authored
chore: Improve account list performance (#14910)
<!-- 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. --> ## **Description** This is a minor PR that aims to improve the rendering performance of the AccountsList component with some basic tricks. This PR has no functional differences with what is already in main. 1. extract inline functions into their own variables so that they can be memoized 2. remove the need to iterate over all the accounts in the AccountsController. Instead we simple lookup the account via address. 3. memoize the component 4. memoize the icon selector with a shallow equal. None of these will make massive improvements but they are best practices and could give us small benefits. It also makes the component easier to reason about. ## **Related issues** Fixes: ## **Manual testing steps** 1. create/import a wallet 2. click on the selected account at the top of the screen 3. once the account list opens, all of your accounts with the correct names and balances should render 4. selecting a new account should change your selected account 5. editing an account name should properly change the name in the list and the home page. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** ### **After** https://github.com/user-attachments/assets/88724a2f-1c5f-4a2b-944f-ce6dfd2a31f0 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/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.
1 parent 5eb00cc commit 22d9f91

File tree

6 files changed

+1240
-543
lines changed

6 files changed

+1240
-543
lines changed

0 commit comments

Comments
 (0)