Skip to content
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: Reapply migration 52 to fix undefined selectedAccount #12115

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

Cal-L
Copy link
Contributor

@Cal-L Cal-L commented Oct 31, 2024

Description

This PR fixes #11866 where it ensures that selectedAccount in the AccountsController is defined.

Related issues

Fixes: #11866

Manual testing steps

  1. Run main and create a wallet with 3 accounts, select account 1
  2. Kill the app and apply a migration that sets selectedAccount in the AccountsController to undefined, re-run yarn watch and re-open app
  3. Notice that the app is stuck on the splash screen
  4. Kill the app and run this branch, which applies the migration that fixes the issue. Notice that the app is now accessible again

Screenshots/Recordings

Before

Screenshot 2024-10-30 at 4 42 44 PM Screenshot 2024-10-30 at 4 43 07 PM

After

App is accessible again
Screenshot 2024-10-30 at 10 11 24 PM

Pre-merge author checklist

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.

@Cal-L Cal-L requested a review from a team as a code owner October 31, 2024 05:11
Copy link
Contributor

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.

@Cal-L Cal-L added Run Smoke E2E Triggers smoke e2e on Bitrise needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Oct 31, 2024
@Cal-L Cal-L changed the title fix: Reapply migration 52 and fix conditions fix: Reapply migration 52 to fix undefined selectedAccount Oct 31, 2024
app/store/migrations/052.test.ts Show resolved Hide resolved
app/store/migrations/052.ts Show resolved Hide resolved
app/store/migrations/057.ts Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 78.57143% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.57%. Comparing base (ead35c4) to head (83f6725).
Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
app/store/migrations/057.ts 76.92% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12115      +/-   ##
==========================================
+ Coverage   55.35%   55.57%   +0.22%     
==========================================
  Files        1767     1781      +14     
  Lines       39841    40086     +245     
  Branches     4965     5001      +36     
==========================================
+ Hits        22052    22279     +227     
- Misses      16274    16283       +9     
- Partials     1515     1524       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Copy link
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but requires some code comment on the situation of having 57 similar to 52 migration.

app/store/migrations/057.ts Show resolved Hide resolved
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of suggestions on how this could be improved, but overall LGTM!

@NicolasMassart NicolasMassart added this pull request to the merge queue Oct 31, 2024
Merged via the queue into main with commit dfcd8c8 Oct 31, 2024
50 of 52 checks passed
@NicolasMassart NicolasMassart deleted the fix/11866-undefined-selectedAccount branch October 31, 2024 15:01
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Oct 31, 2024
@metamaskbot metamaskbot added the release-7.35.0 Issue or pull request that will be included in release 7.35.0 label Oct 31, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 31, 2024
<!--
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?
-->

These changes refactors migration 52 and 57 to use consolidated logic.
Comments was also added explaining that the migrations are the same

## **Related issues**

Fixes: #12115 

## **Manual testing steps**

Follow same steps in PR
#12115

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **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.

---------

Co-authored-by: Nico MASSART <NicolasMassart@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.35.0 Issue or pull request that will be included in release 7.35.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-mobile-platform
Projects
Archived in project
6 participants