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: add contractBalances as dependency #12205

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Nov 6, 2024

Description

This PR forces UI to rerender when contractBalances change in state.

When a user switches from account A to account B; the value of contractBalances would still have the state values from accountA;
If account A and accountB have some tokens in common (exp both hold USDC) you would see the total = native fiat value + USDC value;
Also; When a user switches accounts, the tokensStateChange subscription is fired; except that by the time it got to update the contractBalances in state; the UI has already rendered the total fiat value;
The reason why after a while, it would update to the correct total value; is because the conversionRate in state would change forcing the UI to re-render the component;
My fix here is adding contractBalances as a dependency which will force the array to rerender once contractBalances in state are updated;

Related issues

Fixes:

Manual testing steps

  1. Import two accounts with native and ERC20 balances
  2. Switch between accounts;
  3. You should see the correct total balance in fiat

Screenshots/Recordings

Before

Screen.Recording.2024-11-06.at.15.40.04.mov

After

Screen.Recording.2024-11-06.at.15.43.41.mov

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.

Copy link
Contributor

github-actions bot commented Nov 6, 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.

@sahar-fehri sahar-fehri added Run Smoke E2E Triggers smoke e2e on Bitrise needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. labels Nov 6, 2024
Copy link
Contributor

github-actions bot commented Nov 6, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: e0489a5
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/4cb4b9c6-859b-426b-b8fa-ea3516c11e17

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link

sonarqubecloud bot commented Nov 6, 2024

@sahar-fehri sahar-fehri marked this pull request as ready for review November 6, 2024 14:58
@sahar-fehri sahar-fehri requested a review from a team as a code owner November 6, 2024 14:58
@alfeng6 alfeng6 added the Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing label Nov 6, 2024
Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

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

LGTM

@sahar-fehri sahar-fehri added this pull request to the merge queue Nov 7, 2024
Merged via the queue into main with commit e446dc1 Nov 7, 2024
52 of 55 checks passed
@sahar-fehri sahar-fehri deleted the fix/fix-totalFiatBalance-render branch November 7, 2024 08:05
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2024
@gauthierpetetin gauthierpetetin added the release-7.36.0 Issue or pull request that will be included in release 7.36.0 label Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. release-7.36.0 Issue or pull request that will be included in release 7.36.0 Run Smoke E2E Triggers smoke e2e on Bitrise Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants