-
Notifications
You must be signed in to change notification settings - Fork 5k
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: fix percentage changes when balance is zero #25550
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 [72753de]
Page Load Metrics (136 ± 185 ms)
Bundle size diffs
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #25550 +/- ##
========================================
Coverage 69.67% 69.67%
========================================
Files 1349 1349
Lines 47850 47850
Branches 13195 13196 +1
========================================
Hits 33337 33337
Misses 14513 14513 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Description
This PR addresses a UI inconsistency observed in the account balance display, particularly when the account balance is at 0.00. Users have reported confusion over the display of a non-zero percentage change next to a +0.00 change in account value. This scenario occurs when there is no balance (neither in ETH nor in the selected fiat currency, USD in this case) in the user's account. The expectation is that if the account has not increased or decreased in value (due to having no balance), the displayed percentage change should also reflect a 0% change, aligning with the +$0.00 change displayed.
Problem: When the account balance is zero, the UI currently shows a +$0.00 change (as expected) but accompanies this with a non-zero percentage change (e.g., -1.74%), which is misleading and confusing to users. This discrepancy occurs despite the account's value not actually changing, given the lack of funds.
Solution: The proposed solution involves adjusting the logic that calculates and displays the percentage change in account value. Specifically, when the account balance is $0.00, the percentage change should also display as +0.00%, reflecting the true state of the account's value change (or lack thereof). This change ensures consistency in the UI and improves user understanding of their account's status.
Implementation Details:
Modify the calculation function to check for a $0.00 account balance condition. Upon detecting this condition, the function will automatically set the percentage change value to +0.00%.
Update the UI component responsible for displaying the percentage change to correctly render the +0.00% value when the account balance is zero.
Add unit tests to cover this scenario, ensuring that the percentage change correctly reflects a 0% change when the account balance is $0.00.
Expected Outcome: With this fix, users with a 0.00 account balance will see both a +0.00 change and a +0.00% change, eliminating confusion and providing a clearer understanding of their account's status. This update aims to enhance the user experience by ensuring consistency and clarity in the display of account value changes.
Related issues
Fixes: #25539
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist