fix: fix selectedAddress and nftController instantiation#22856
fix: fix selectedAddress and nftController instantiation#22856sahar-fehri merged 10 commits intodevelopfrom
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. |
Builds ready [a1558d8]
Page Load Metrics (943 ± 185 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #22856 +/- ##
===========================================
+ Coverage 68.47% 68.47% +0.01%
===========================================
Files 1088 1088
Lines 42956 42962 +6
Branches 11436 11432 -4
===========================================
+ Hits 29410 29417 +7
+ Misses 13546 13545 -1 ☔ View full report in Codecov by Sentry. |
| !currentTabIsConnectedToNextAddress; | ||
|
|
||
| try { | ||
| await _setSelectedAddress(address); |
There was a problem hiding this comment.
_setSelectedAddress function will switch preferencesController's selected address, even though account is not found in accountsController,
it might cause inconsistent address state between preferencesController and accountsController.
There was a problem hiding this comment.
To avoid this inconsistency, we will first check if the account is found first, then we will update the controllers.
If account was not found, no controllers will be updated.
122b25e to
02a751c
Compare
Builds ready [02a751c]
Page Load Metrics (1067 ± 68 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Noticed that when you freshly import the extension, usse testDapp to deploy and mint an NFT, then manually import the NFT.
you will be able to see the NFT. Then when you switch to another account and go back to the account that has the NFT;
1- you wont be able to see the NFTs you imported earlier
2- When you try to import them again you will get an error (fired from core when trying to verify ownership)
Noticed that this was due to core having the wrong userAddress to check ownership for, and then in metamask.js, the selectedAddress retrieved does not match the user's selected Address
This behavior is also reported to be on v11.10.0, on this issue: #22796
Related issues
Fixes: #22796
Fixes: #22798
Manual testing steps
Screenshots/Recordings
Before
devBefore.mov
After
DevAfter.mov
Pre-merge author checklist
Pre-merge reviewer checklist