-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(card): delegation issues #22058
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(card): delegation issues #22058
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. |
…ard-delegation-issues
…ard-delegation-issues
| // Some locales use comma as decimal separator (e.g., "4,95551" instead of "4.95551") | ||
| const normalizedBalance = (balanceToUse || '0').replace(',', '.'); | ||
| const rawTokenBalance = parseFloat(normalizedBalance); | ||
| const balanceFormatted = `${parseFloat(normalizedBalance).toFixed(6)} ${token.symbol}`; |
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.
Bug: NaN Propagates Through Number Formatting Edgecase
If parseFloat() receives an invalid balance string, it returns NaN. This can cause toFixed(6) to either display "NaN" in the UI or throw a TypeError when attempting to format the invalid number.
Additional Locations (1)
|



Description
This PR addresses several issues affecting the Card experience, ensuring proper asset display, navigation flow, and data consistency across components.
Fixes
availableBalancefor enabled tokens and the user’s total balance for disabled ones.useLoadCardDatahook.Changelog
CHANGELOG entry: Fixed issue where assets failed to load after opening the Card Home screen.
CHANGELOG entry: Fixed balance display on the Change Asset Bottom Sheet to correctly show availableBalance for enabled tokens and user balance for disabled tokens.
CHANGELOG entry: Restored missing asset icons on asset bottom sheets.
CHANGELOG entry: Fixed incorrect Spending Limit title when selecting a token that’s not enabled (now shows “Change token and network”).
CHANGELOG entry: Fixed incorrect Spending Limit title when pressing “Manage spending limit” on Card Home (now shows “Enable token”).
CHANGELOG entry: Resolved concurrency and caching issues in useLoadCardData hook.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Replaces balance logic with aggregated hook, adds pull-to-refresh and spending limit progress/warning on Card Home, fixes navigation/metrics/caching, strengthens delegation/external wallet flows, and adds extensive tests.
balanceFormattedfallback when fiat unavailable; update metrics gating and properties.useAssetBalanceswith per-token keying; show correct balances (available vs wallet), restore icons, exclude Solana where needed.useAssetBalance/useAssetsListwithuseAssetBalances(map-based, multi-token).useLoadCardDatawith explicit (re)fetch controls, cache-clearing on auth errors, and concurrency fixes.Written by Cursor Bugbot for commit 2f10229. This will update automatically on new commits. Configure here.