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: improve native balance fetch logic on the UX #8556

Merged
merged 5 commits into from
Feb 16, 2024

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Feb 8, 2024

Description

Problem: When we change network or account, the native balance of the ERC-20 tokens is not reset. It shows a wrong value for a couple seconds and then updates.

We should reset the state and show a skeleton text instead of a wrong value.

PR already Merged on core

Related issues

Fixes: #6101

Manual testing steps

  1. Go to any network where you hold native tokens
  2. switch to another network when you have 0 balance
  3. you can see that the wrong balance was displayed for a short time

Screenshots/Recordings

Before

before.mov

After

after.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • 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.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@salimtb salimtb requested a review from a team as a code owner February 8, 2024 17:38
Copy link
Contributor

github-actions bot commented Feb 8, 2024

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.

@salimtb salimtb added team-assets needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-mobile-ux DEPRECATED: please use "team-wallet-ux" label instead labels Feb 8, 2024
@salimtb salimtb force-pushed the fix/improve-native-balance-fetch branch from bb9a9fb to f2a1df0 Compare February 8, 2024 17:45
@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2024

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (a867002) 41.05% compared to head (65e9c0b) 41.05%.

Files Patch % Lines
app/components/UI/Ramp/hooks/useBalance.ts 0.00% 4 Missing ⚠️
...mponents/UI/Ramp/hooks/useHandleSuccessfulOrder.ts 0.00% 3 Missing ⚠️
app/core/Engine.ts 25.00% 3 Missing ⚠️
app/components/UI/AssetOverview/AssetOverview.tsx 0.00% 2 Missing ⚠️
...mponents/Views/NetworkSelector/NetworkSelector.tsx 0.00% 2 Missing ⚠️
app/components/Views/Wallet/index.tsx 33.33% 1 Missing and 1 partial ⚠️
.../components/UI/NetworkModal/NetworkAdded/index.tsx 0.00% 1 Missing ⚠️
app/components/Views/ActivityView/index.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8556   +/-   ##
=======================================
  Coverage   41.05%   41.05%           
=======================================
  Files        1247     1247           
  Lines       30362    30371    +9     
  Branches     2964     2965    +1     
=======================================
+ Hits        12464    12468    +4     
- Misses      17153    17158    +5     
  Partials      745      745           

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

@salimtb salimtb added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 8, 2024
Copy link
Contributor

github-actions bot commented Feb 8, 2024

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/8aa420f9-0e8d-4103-b819-bf2c942ca6ed
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@salimtb salimtb added team-wallet-ux and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 9, 2024
@chrisleewilcox
Copy link
Contributor

chrisleewilcox commented Feb 13, 2024

Error on regression tests ./e2e/specs/networks/add-custom-rpc.spec.js

Copy link
Contributor

@chrisleewilcox chrisleewilcox left a comment

Choose a reason for hiding this comment

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

@salimtb
Copy link
Contributor Author

salimtb commented Feb 14, 2024

https://app.bitrise.io/build/10e18cd4-22e2-4688-b017-44cb87f8716c to address test failure.

fixed

@salimtb salimtb added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 14, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a1cc2f19-14a4-4c12-9e30-0d50b8d10ac3
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@salimtb salimtb removed the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 14, 2024
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Left a comment

app/components/Views/Wallet/index.tsx Outdated Show resolved Hide resolved
@salimtb salimtb force-pushed the fix/improve-native-balance-fetch branch from eaeed3e to 36e07f0 Compare February 16, 2024 13:27
@salimtb salimtb force-pushed the fix/improve-native-balance-fetch branch from 27e2649 to 65e9c0b Compare February 16, 2024 15:45
@salimtb salimtb added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 16, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/5d63e9b4-b18a-4401-a895-89dce4049157
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

Copy link

sonarcloud bot commented Feb 16, 2024

@chrisleewilcox chrisleewilcox added the Spot Check on the Release Build If a ticket doesn't require feature QA, but does require some form of manual spot checking label Feb 16, 2024
Copy link
Contributor

@chrisleewilcox chrisleewilcox left a comment

Choose a reason for hiding this comment

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

LGTM

@chrisleewilcox chrisleewilcox merged commit 542af2c into main Feb 16, 2024
30 checks passed
@chrisleewilcox chrisleewilcox deleted the fix/improve-native-balance-fetch branch February 16, 2024 18:03
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 16, 2024
@metamaskbot metamaskbot added the release-7.17.0 Issue or pull request that will be included in release 7.17.0 label Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.17.0 Issue or pull request that will be included in release 7.17.0 Run Smoke E2E Triggers smoke e2e on Bitrise Spot Check on the Release Build If a ticket doesn't require feature QA, but does require some form of manual spot checking team-assets team-mobile-ux DEPRECATED: please use "team-wallet-ux" label instead team-wallet-ux
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Core: Improve of native balance of the ERC-20 tokens
6 participants