fix: handle unsupported network from API#42657
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. |
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (2 files, +155 -3)
|
|
Builds ready [336478e]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|



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
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes runtime query behavior for transactions fetching/prefetching by intercepting specific
HttpError400 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
queryFnto return an empty transactions response instead of throwing.Adds a shared
getErrorBodyMessagehelper to safely readbody.messagefor error matching, and expands tests to cover the new normalization behavior for bothuseTransactionsQueryandusePrefetchTransactions(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.