Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Create migration 59 to fix undefined selectedAccount (#12177)
<!-- 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 addresses a crasher related to an undefined selectedAccount causing the AccountsController to throw an error. Under this scenario, the solution is to set selectedAccount to an empty string, which the AccountsController will automatically reset the selectedAccount. PR similar to #11866 but not the same ## **Related issues** Fixes: #11488 ## **Manual testing steps** 1. Building on `main`, create a wallet and kill the app 2. Create a migration that sets `selectedAccount` on the AccountsController to be undefined 3. Run the app, notice it encounters the error. Kill the app 4. Run this branch, which includes migration 59. Notice you are no longer blocked and can log in 5. Will see an account selected by default after landing on wallet ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> The error that users eventually see as a result of the migration failures <img width="1101" alt="Screenshot 2024-11-04 at 11 21 55 PM" src="https://github.com/user-attachments/assets/c944e7ce-f68d-4cb6-b949-b8b57a4d8ec8"> ### **After** <!-- [screenshots/recordings] --> After applying migration https://github.com/user-attachments/assets/e959c8d9-5dfd-4b69-8f4d-16689bf66d95 ## **Pre-merge author checklist** - [x] 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). - [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