Skip to content

fix: handle unsupported network from API#42657

Merged
n3ps merged 4 commits into
mainfrom
n3ps/fix-api-unsupported-network
May 13, 2026
Merged

fix: handle unsupported network from API#42657
n3ps merged 4 commits into
mainfrom
n3ps/fix-api-unsupported-network

Conversation

@n3ps
Copy link
Copy Markdown
Contributor

@n3ps n3ps commented May 13, 2026

Description

API treats unsupported networks as a 400 error

This PR normalizes that response as an empty result instead

Changelog

CHANGELOG entry: fix: handle unsupported network from API

Related issues

Fixes: #42402

Manual testing steps

  1. On an empty account
  2. Go to Activity tab
  3. Switch to a known API-unsupported network ie. Avalanche

Screenshots/Recordings

Before

image

After

image

Pre-merge author checklist

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

Medium Risk
Changes runtime query behavior for transactions fetching/prefetching by intercepting specific HttpError 400 responses and returning an empty dataset, which could mask real API issues if the message match is too broad.

Overview
Prevents the Activity transactions query from failing when the Accounts API returns a known unsupported networks 400 error by wrapping the React Query queryFn to return an empty transactions response instead of throwing.

Adds a shared getErrorBodyMessage helper to safely read body.message for error matching, and expands tests to cover the new normalization behavior for both useTransactionsQuery and usePrefetchTransactions (while ensuring unexpected errors still reject).

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

@n3ps n3ps requested a review from a team as a code owner May 13, 2026 15:07
@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.

@n3ps n3ps changed the title fix: handle unsupported activity transaction networks fix: handle unsupported network from API May 13, 2026
@metamaskbot metamaskbot added the team-core-extension-ux Core Extension UX team label May 13, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 13, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/core-extension-ux (2 files, +155 -3)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain/
        • 📁 activity-v2/
          • 📄 useTransactionsQuery.test.ts +103 -1
          • 📄 useTransactionsQuery.ts +52 -2

@n3ps n3ps enabled auto-merge May 13, 2026 15:39
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue May 13, 2026
@sonarqubecloud
Copy link
Copy Markdown

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 Bot commented May 13, 2026

Builds ready [336478e]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 9 warn · 🔴 0 fail)

Baseline (latest main): 51036da | Date: 5/2/2026 | Pipeline: 25810125888 | Baseline logs

Interaction Benchmarks · Samples: 5
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
confirmTx
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -74%
  • loadNewAccount/total: -74%
  • bridgeUserActions/bridge_load_page: -29%
  • bridgeUserActions/bridge_load_asset_picker: -23%
  • bridgeUserActions/bridge_search_token: -29%
  • bridgeUserActions/total: -29%
  • loadNewAccount/load_new_account: -73%
  • loadNewAccount/total: -73%
  • bridgeUserActions/bridge_load_page: -19%
  • bridgeUserActions/bridge_load_asset_picker: -57%
  • bridgeUserActions/bridge_search_token: -37%
  • bridgeUserActions/total: -36%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.0s
  • 🟡 confirmTx/FCP: p75 2.0s
  • 🟡 bridgeUserActions/FCP: p75 2.0s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
startupPowerUserHome
[Sentry log · main/release]
🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: -17%
  • startupStandardHome/load: -12%
  • startupStandardHome/domContentLoaded: -12%
  • startupStandardHome/domInteractive: +14%
  • startupStandardHome/firstPaint: +12%
  • startupStandardHome/backgroundConnect: -37%
  • startupStandardHome/firstReactRender: -22%
  • startupStandardHome/loadScripts: -12%
  • startupStandardHome/numNetworkReqs: -50%
  • startupStandardHome/uiStartup: -17%
  • startupStandardHome/domInteractive: -55%
  • startupStandardHome/backgroundConnect: -14%
  • startupStandardHome/initialActions: -40%
  • startupStandardHome/setupStore: -58%
  • startupStandardHome/numNetworkReqs: -45%
  • startupPowerUserHome/uiStartup: -43%
  • startupPowerUserHome/load: -19%
  • startupPowerUserHome/domContentLoaded: -19%
  • startupPowerUserHome/domInteractive: -73%
  • startupPowerUserHome/backgroundConnect: -47%
  • startupPowerUserHome/firstReactRender: -14%
  • startupPowerUserHome/loadScripts: -17%
  • startupPowerUserHome/setupStore: -89%
  • startupPowerUserHome/numNetworkReqs: -69%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 startupPowerUserHome/LCP: p75 2.8s
User Journey Benchmarks · Samples: 5 · mock API
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
assetDetails
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
solanaAssetDetails
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
importSrpHome
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
sendTransactions
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]
swap
[Sentry log · main/release]
🟡 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/srpButtonToSrpForm: -83%
  • onboardingImportWallet/pwFormToMetricsScreen: +629%
  • onboardingImportWallet/doneButtonToHomeScreen: -78%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +23%
  • onboardingImportWallet/total: -43%
  • onboardingNewWallet/srpButtonToPwForm: -75%
  • onboardingNewWallet/createPwToRecoveryScreen: +1207%
  • onboardingNewWallet/skipBackupToMetricsScreen: -62%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: +16%
  • onboardingNewWallet/doneButtonToAssetList: -29%
  • onboardingNewWallet/total: -24%
  • assetDetails/assetClickToPriceChart: -47%
  • assetDetails/total: -47%
  • solanaAssetDetails/assetClickToPriceChart: -74%
  • solanaAssetDetails/total: -74%
  • importSrpHome/loginToHomeScreen: -16%
  • importSrpHome/openAccountMenuAfterLogin: -78%
  • importSrpHome/homeAfterImportWithNewWallet: -69%
  • importSrpHome/total: -62%
  • swap/openSwapPageFromHome: -97%
  • swap/fetchAndDisplaySwapQuotes: +36%
  • swap/total: +12%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 assetDetails/INP: p75 208ms
  • 🟡 assetDetails/FCP: p75 1.9s
  • 🟡 solanaAssetDetails/FCP: p75 1.9s
  • 🟡 importSrpHome/FCP: p75 1.9s
  • 🟡 sendTransactions/INP: p75 272ms
  • 🟡 sendTransactions/FCP: p75 1.9s
  • 🟡 swap/FCP: p75 2.0s
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • dappPageLoad/pageLoadTime: +25%
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 6.06 MiB (100%)
  • ui: 9.42 MiB (100%)
  • common: 11.95 MiB (100%)

@n3ps n3ps added this pull request to the merge queue May 13, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue May 13, 2026
Merged via the queue into main with commit 4e0be4f May 13, 2026
213 checks passed
@n3ps n3ps deleted the n3ps/fix-api-unsupported-network branch May 13, 2026 18:40
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue May 13, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
@metamaskbot metamaskbot added the release-13.32.0 Issue or pull request that will be included in release 13.32.0 label May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.32.0 Issue or pull request that will be included in release 13.32.0 size-M team-core-extension-ux Core Extension UX team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: Activity: We could't load this page displayed for Avalanche, zkSync and MegaETH networks and Try again button unresponsive

4 participants