metamask-extension
metamask-extension copied to clipboard
fix: erc20 import error
Description
When you try to import an ERC20, it will require clicking on the next button twice before moving to the confirmation modal. You will also see this error in the console:
SES_UNHANDLED_REJECTION: Error: Invariant failed: A state mutation was detected between dispatches, in the path 'metamask.tokenList.0x0000000000300dd8b0230efcfef136ecdf6abcde.unlisted'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)
(see video)
I used spread operator to update the "unlisted" value in tokens instead of changing its value directly.
Related issues
Fixes:
Manual testing steps
- Go to home age
- Click on import tokens and select any token from the list
- Click on "Next" button. Make sure you have only clicked the button once and you were moved successfully to confirmation page.
- The error should not appear in console.
Screenshots/Recordings
Before
https://github.com/MetaMask/metamask-extension/assets/10994169/d207512e-2523-464b-a7fd-198110d1e0fb
After
https://github.com/MetaMask/metamask-extension/assets/10994169/d00b829b-fc0a-4272-af52-573bd98f23a1
Pre-merge author checklist
- [ ] I’ve followed MetaMask Coding Standards.
- [ ] 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 format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). 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.
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.
Codecov Report
Attention: Patch coverage is 0%
with 2 lines
in your changes are missing coverage. Please review.
Project coverage is 67.37%. Comparing base (
d8fd077
) to head (250d7a9
).
:exclamation: Current head 250d7a9 differs from pull request most recent head c811dff
Please upload reports for the commit c811dff to get more accurate results.
Files | Patch % | Lines |
---|---|---|
ui/store/actions.ts | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #24620 +/- ##
===========================================
- Coverage 67.40% 67.37% -0.02%
===========================================
Files 1289 1289
Lines 50248 50221 -27
Branches 13011 13005 -6
===========================================
- Hits 33865 33835 -30
- Misses 16383 16386 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [250d7a9]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (294 ± 326 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 68 | 117 | 86 | 13 | 6 |
domContentLoaded | 9 | 30 | 14 | 6 | 3 | ||
load | 54 | 2477 | 294 | 679 | 326 | ||
domInteractive | 9 | 30 | 14 | 6 | 3 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 20 Bytes (0.00%)
LGTM ! Smooth fix !
Builds ready [c811dff]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (944 ± 519 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 57 | 157 | 95 | 24 | 11 |
domContentLoaded | 9 | 43 | 17 | 11 | 5 | ||
load | 47 | 2564 | 944 | 1081 | 519 | ||
domInteractive | 8 | 43 | 17 | 11 | 5 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 20 Bytes (0.00%)