[pull] main from MetaMask:main#50
Merged
Merged
Conversation
## **Description**
1. What is the reason for the change?
- Performance regressions was found during release testing for 7.53.0
- I believe the root cause of this issue is the following...
- The initial state of the accounts controller is an empty array[]
- FlashList uses the size of the list combined with the
`estimatedItemSize` prop to draw the list
- Since 7.51 and 7.53, we introduced multi chain accounts state 1 which
changes how the accounts list is rendered. The size of elements is more
dynamic (since now we render wallet name, account cell and footers).
This combined with the fact that the initial list size starts at 0 was
causing issues for the native android RecyclerListView.
- This warning was logged in the console while testing:
- `WARN FlashList's rendered size is not usable. Either the height or
width is too small (<2px). Please make sure that the parent view of the
list has a valid size. FlashList will match the size of the parent.1`
- There are several issues online with [this
warning](https://stackoverflow.com/questions/73516978/flashlists-rendered-size-is-not-usable).
- Why update to FlashList v2 instead of fixing the root cause of the
issue?
- Potential solution 1: Give the list a fixed height
- This is not possible since the list lives in a bottom drawer popup
that has a dynamic height
- Potential Solution 2: Stop the useAccounts hook from returning an
empty array as its initial state.
- This is a much more difficult fix since that hook combines logic from
over 7 selectors.
- hooks are expected to have state updates and thus handling the dynamic
size of the data is a normal react construct. If anything it was a bug
in FlashList.
2. What is the improvement/solution?
- Update to FlashList v2 for the following reasons:
- FlashList v2 handles the dynamic height and list size values without
issues
- Easier to use API (no more need for estimatedSize prop)
- No more fixed height requirement
- Fixes the scroll to selected account issue that was present since we
migrated to FlashList v1
### Resources
- [Migrating from FlashList v1 to
v2](https://shopify.github.io/flash-list/docs/v2-migration)
- [FlashList v2: A Ground-Up Rewrite for React Native's New
Architecture](https://shopify.engineering/flashlist-v2)
- [What's new in
v2](https://shopify.github.io/flash-list/docs/v2-changes/)
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes: #17541
## **Manual testing steps**
1. Import an SRP with many accounts or create many accounts within your
existing wallet
2. open the account list
3. the list should open within a reasonable amount of time and not
require a touch event to complete the rendering cycle
4. the list should scroll to the currently selected account
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
https://github.com/user-attachments/assets/ba7a15ff-5521-4239-a875-65c0ed88d491
### **After**
https://github.com/user-attachments/assets/01ab18ef-d0f4-4c94-8568-0374c936dbba
## **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.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )