Skip to content

fix: add token image fallback in AssetLogo (ASSETS-3156)#29827

Merged
Prithpal-Sooriya merged 3 commits into
mainfrom
cursor/assets-3156-image-fallback-fa93
May 7, 2026
Merged

fix: add token image fallback in AssetLogo (ASSETS-3156)#29827
Prithpal-Sooriya merged 3 commits into
mainfrom
cursor/assets-3156-image-fallback-fa93

Conversation

@Prithpal-Sooriya

@Prithpal-Sooriya Prithpal-Sooriya commented May 6, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes token logo rendering for non-native assets when asset.image is empty (the issue affecting mUSD/Money integration).

The AssetLogo component now:

  • computes a fallback icon URL via getAssetImageUrl when the primary image is missing,
  • only attempts fallback generation for valid CAIP or strict-hex chain IDs,
  • passes imageSource={{ uri: imageUri }} so undefined URI values are handled directly by AvatarToken.

It also adds unit tests to cover fallback behavior and unsupported chain-id behavior.

Changelog

CHANGELOG entry: fix: fixed token list items to use a fallback icon when token image URLs are missing

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3156

Manual testing steps

Feature: Token list item image fallback

  Scenario: Token with missing image URL still shows an icon
    Given a token list item where asset.image is empty
    When the token list item renders
    Then AssetLogo resolves and uses a fallback image URL for valid chain IDs
    And the token icon is shown instead of an empty image

  Scenario: Unsupported chain id does not crash icon rendering
    Given a token list item where asset.image is empty and chainId is unsupported
    When the token list item renders
    Then AssetLogo does not attempt invalid fallback URL generation
    And AvatarToken renders safely when uri is undefined

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.
Open in Web Open in Cursor 

Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Comment thread app/components/UI/Assets/components/AssetLogo/AssetLogo.tsx
Comment thread app/components/UI/Assets/components/AssetLogo/AssetLogo.tsx Outdated
@github-actions github-actions Bot added size-M and removed size-S labels May 6, 2026
@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokeSwap, SmokeStake, SmokeConfirmations, SmokeMoney
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes add a fallback image URL mechanism to AssetLogo.tsx: when a token's image field is empty/falsy, it now calls getAssetImageUrl (from Bridge utilities) using the asset's address and chainId (supporting CAIP and hex formats). This is a defensive, additive UI enhancement with no breaking changes.

AssetLogo is used across many components:

  • TokenListItem (wallet token list → SmokeWalletPlatform)
  • AssetOverview/Balance (token details → SmokeWalletPlatform)
  • EarnTokenSelector, StakingBalance, StakingConfirmation (→ SmokeStake + SmokeConfirmations)
  • CardAssetItem (→ SmokeMoney)
  • Confirmations components: token, cancel-speedup-modal, gas-fee-token-icon, hero-token (→ SmokeConfirmations)
  • Swap flows use token avatars (→ SmokeSwap + SmokeConfirmations)

Per tag descriptions: SmokeSwap and SmokeStake require SmokeConfirmations. SmokeMoney is included for CardAssetItem usage.

The change is low risk — it's purely a UI fallback for missing token images, with proper validation guards (chainId format checks). No controller, Engine, navigation, or state management changes.

Performance Test Selection:
The change adds a lightweight fallback URL computation (string manipulation via isCaipChainId/isStrictHexString checks and getAssetImageUrl). This is not a new network call or heavy rendering operation — getAssetImageUrl constructs a static CDN URL string. No meaningful performance impact is expected on rendering times, asset loading, or any other measured performance metric.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 6, 2026

Copy link
Copy Markdown

@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review May 7, 2026 08:11
@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner May 7, 2026 08:11
@Prithpal-Sooriya Prithpal-Sooriya enabled auto-merge May 7, 2026 08:18
@Prithpal-Sooriya Prithpal-Sooriya added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit b22424a May 7, 2026
258 of 263 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the cursor/assets-3156-image-fallback-fa93 branch May 7, 2026 08:54
@github-actions github-actions Bot locked and limited conversation to collaborators May 7, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants