Skip to content

fix: fix navigation to token details from custom network cp-7.74.0#28972

Merged
sahar-fehri merged 4 commits into
mainfrom
fix/fix-navigation-to-token-details-from-custom-network
Apr 17, 2026
Merged

fix: fix navigation to token details from custom network cp-7.74.0#28972
sahar-fehri merged 4 commits into
mainfrom
fix/fix-navigation-to-token-details-from-custom-network

Conversation

@sahar-fehri

@sahar-fehri sahar-fehri commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a crash that occurred when viewing token details on custom or unsupported networks (e.g., Fantom, Linea Sepolia, custom EVM chains).

Issue

When users navigated to token details on networks not supported by the Swaps/Bridge formatAddressToAssetId, the app would crash with:

Error: No XChain Swaps native asset found for chainId: eip155:59141

Reproduction Steps:

  1. Navigate to a custom network (e.g., Fantom with chainId 0xfa)
  2. Select any token on that network
  3. App crashes when trying to display token details

Solution

Added a try-catch wrapper around the formatAddressToAssetId call in Price.advanced.tsx. When the function throws an error for unsupported chains:

Changelog

CHANGELOG entry: Fix navigation error on token details page when coming from custom network flow

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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.

Note

Low Risk
Low risk: a small defensive change that only affects advanced price chart initialization, with added tests covering unsupported-chain fallbacks.

Overview
Prevents crashes in PriceAdvanced on unsupported/custom networks by wrapping formatAddressToAssetId in a try/catch and using an empty assetId when formatting fails, allowing the UI to fall back to PriceLegacy instead of throwing.

Extends Price.advanced.test.tsx with coverage for custom/unsupported chainIds (including Linea Sepolia) and verifies useOHLCVChart is invoked with assetId: '' in the failure case, while supported networks still render the advanced chart.

Reviewed by Cursor Bugbot for commit 706896b. Bugbot is set up for automated code reviews on this repo. Configure here.

@sahar-fehri sahar-fehri requested a review from a team as a code owner April 17, 2026 11:56
@github-actions

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 added size-M risk-low Low testing needed · Low bug introduction risk labels Apr 17, 2026
@sahar-fehri sahar-fehri changed the title fix: fix navigation to token details from custom network fix: fix navigation to token details from custom network cp-7.74.0 Apr 17, 2026
juanmigdr
juanmigdr previously approved these changes Apr 17, 2026
@sahar-fehri sahar-fehri enabled auto-merge April 17, 2026 12:02
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 17, 2026
Comment thread app/components/UI/AssetOverview/Price/Price.advanced.test.tsx Outdated
Comment thread app/components/UI/AssetOverview/Price/Price.advanced.test.tsx Outdated
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 17, 2026
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are limited to two files in the AssetOverview/Price component:

  1. Price.advanced.tsx: A small defensive bug fix wrapping formatAddressToAssetId() in a try-catch block. This prevents crashes when users view token prices on unsupported chains (e.g., Linea Sepolia, custom networks). The fix falls back to an empty string, which causes the component to render the legacy chart fallback instead of crashing.

  2. Price.advanced.test.tsx: New unit tests covering the error handling scenarios for unsupported chains.

Impact Assessment:

  • The change is purely defensive error handling with no behavioral change for supported networks
  • Only affects the PriceAdvanced component used in the token/asset detail view (AssetOverview)
  • No changes to controllers, navigation, shared components, or critical paths
  • The Price.tsx component (which imports Price.advanced.tsx) is used in token list items and Perps components, but the fix only affects the error path for unsupported chains

Tag Selection:

  • SmokeWalletPlatform: Most relevant as it covers token/asset display and transaction history. The AssetOverview price chart is part of the wallet's asset viewing experience.
  • No other tags are needed since this is a narrow, defensive fix that doesn't affect confirmations, swaps, network management, or other feature areas.

Performance: No performance impact expected - the change adds a try-catch around an existing synchronous call, which has negligible overhead.

Performance Test Selection:
The change adds a try-catch block around a synchronous call in the PriceAdvanced component. This has negligible performance impact and does not affect rendering performance, data loading, or any critical user flows measured by performance tests.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
12 value mismatches detected (expected — fixture represents an existing user).
View details

@sahar-fehri sahar-fehri added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit fd69c19 Apr 17, 2026
99 checks passed
@sahar-fehri sahar-fehri deleted the fix/fix-navigation-to-token-details-from-custom-network branch April 17, 2026 14:37
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.75.0 Issue or pull request that will be included in release 7.75.0 label Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.75.0 Issue or pull request that will be included in release 7.75.0 risk-low Low testing needed · Low bug introduction risk size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants