-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: Improve AccountListMenu/Item performance #26379
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. |
d2b87ce
to
7e19673
Compare
88235d3
to
dfcd369
Compare
Builds ready [dfcd369]
Page Load Metrics (374 ± 343 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #26379 +/- ##
===========================================
+ Coverage 69.97% 69.99% +0.01%
===========================================
Files 1422 1422
Lines 49938 49929 -9
Branches 13861 13859 -2
===========================================
+ Hits 34943 34944 +1
+ Misses 14995 14985 -10 ☔ View full report in Codecov by Sentry. |
Quality Gate passedIssues Measures |
Builds ready [110a229]
Page Load Metrics (255 ± 269 ms)
Bundle size diffs
|
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.
I think that increasing the use of memoization and callbacks is good practice. I found the app to be efficient and not have any lagging when working with 10+ accounts.
Description
memoize AccountsListItem
remove
getSelectedInternalAccount
form AccountsListItem since this component already has a prop calledselected
that uses the same logic. Lifting this state to the parent means that theAccountsListItem
will not need to re render. Also a change in thegetSelectedInternalAccount
would trigger a re render of all its parents which is unnecessary.memoize callbacks in the AccountListMenu
This PR has minor changes and should not effect any user flows. It does not require QA before merging
Related issues
Fixes: https://github.com/MetaMask/accounts-planning/issues/512
Manual testing steps
Screenshots/Recordings
Before
After
Screen.Recording.2024-08-14.at.12.13.19.PM.1080.mov
Pre-merge author checklist
Pre-merge reviewer checklist