-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix/9662 account section disappears (#9733)
<!-- 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** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR fixes the issue where the accounts section on the wallet screen disappears after re-authenticating post app auto lock. The main change happens in the `useAccounts` hook, where we are now grabbing the accounts from the `AccountsController` via Redux rather than from the `KeyringController` from the Engine context. We're also now fetching the selected account from the `AccountsController` as well. While the root issue isn't immediately clear, I suspect it has to do with the accounts temporarily disappearing from the KeyringController between lock/auth phases while the app is locked for an extended period of time. In any case, these changes mirror the changes that @owencraston is working on, which will eventually migrate most accounts data to be derived from the `AccountsController`. This fix can serve as a POC that the `AccountsController` is a reliable source of truth when referencing account information. ## **Related issues** Fixes: #9662 #9279 ## **Manual testing steps** 1. Import wallet via SRP 2. Check that phone is set to auto lock 3. Set MM app to immediate lock 4. Go to wallet screen 5. Wait for app to auto lock 6. Wait 5-10mins 7. Unlock phone and re-authenticate to MM 8. Notice account section is still intact on the wallet screen ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-mobile/assets/10508597/27d7823b-1d1f-48a0-89ae-946cdcf6e853 ### **After** <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-mobile/assets/10508597/e8ba2a56-ee2c-48bf-b602-46e62626f1f5 ## **Pre-merge author checklist** - [X] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [X] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [X] 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.
- Loading branch information
Showing
13 changed files
with
1,693 additions
and
231 deletions.
There are no files selected for viewing
This file contains 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
909 changes: 742 additions & 167 deletions
909
app/components/UI/AccountSelectorList/__snapshots__/AccountSelector.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Oops, something went wrong.