-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix: balance and token icons are unavailable when the bridge page is reopened #31343
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
Conversation
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.
Pull Request Overview
This PR addresses an issue where balance and token icons were unavailable when the bridge page was reopened by updating both the balance fetching logic and the token icon assignment.
- Adjusts the balance lookup in useLatestBalance to correctly select a CAIP asset type based on native status.
- Revises token icon assignment logic in the prepare-bridge-page to prioritize available icon URLs.
- Updates token type definitions to include an optional iconUrl field.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
ui/hooks/bridge/useLatestBalance.ts | Updates balance lookup logic using a CAIP asset type based on native address detection. |
ui/pages/bridge/prepare/prepare-bridge-page.tsx | Modifies token icon assignment for both toToken and fromToken, mixing icon and iconUrl sources. |
shared/types/bridge.ts | Adds iconUrl to the BridgeAsset type for enhanced token image support. |
Comments suppressed due to low confidence (2)
ui/pages/bridge/prepare/prepare-bridge-page.tsx:257
- The toToken image property now uses srcAsset.icon as the primary source instead of destAsset.icon; please verify that this change is intentional to match the expected behavior of the bridge page.
image: srcAsset.icon ?? destAsset.iconUrl ?? '',
ui/pages/bridge/prepare/prepare-bridge-page.tsx:265
- Switching from the nullish coalescing operator (??) to the logical OR (||) on this line means falsy values like an empty string are treated differently; please confirm if this behavior is desired.
image: srcAsset.icon || srcAsset.iconUrl || '',
Builds ready [b779fab]
Page Load Metrics (2903 ± 1366 ms)
Bundle size diffs
|
Builds ready [d691a93]
UI Startup Metrics (1220 ± 67 ms)
Bundle size diffs
|
✨ Files requiring CODEOWNER review ✨🔄 @MetaMask/swaps-engineers
|
fa3e9e5
to
70f3b09
Compare
Builds ready [a49e380]
UI Startup Metrics (1177 ± 51 ms)
Bundle size diffs
|
Builds ready [ea01374]
UI Startup Metrics (1172 ± 50 ms)
Bundle size diffs
|
Description
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MMS-2147
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist