feat: cache bridge getToken responses#39541
Merged
Conversation
Contributor
✨ Files requiring CODEOWNER review ✨🔄 @MetaMask/swaps-engineers (7 files, +648 -44)
|
Contributor
Builds ready [b380494]
UI Startup Metrics (1278 ± 100 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
Contributor
Builds ready [e851094]
UI Startup Metrics (1295 ± 112 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
Contributor
Builds ready [9ccb486]
UI Startup Metrics (1319 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Contributor
Builds ready [3a23429]
UI Startup Metrics (1341 ± 121 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
ghgoodreau
approved these changes
Jan 29, 2026
Contributor
Builds ready [b3ffc30]
UI Startup Metrics (1316 ± 110 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
SteP-n-s
approved these changes
Jan 29, 2026
Contributor
Builds ready [065a794]
UI Startup Metrics (1332 ± 102 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Contributor
Builds ready [53538c5]
UI Startup Metrics (1334 ± 96 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds progressive caching for
searchandpopularendpointstimestampis preservedCache Schema
Changelog
CHANGELOG entry: feat: cache bridge getToken responses
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3230
Manual testing steps
localforageentries include 2 "bridgeCache" entries when Swap page loadsScreenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds a new local storage-backed caching layer for bridge token list fetches; risk is mainly around stale/incorrect cache invalidation or hashing leading to missing/old token results.
Overview
Bridge token list requests are now cached in local storage to reduce repeated calls to
getTokens/popularandgetTokens/search.A new
ui/pages/bridge/utils/cache.tsmodule hashes request bodies to generate cache keys, stores responses (including pagedsearchresults) with a 15-minute TTL, and invalidates entries on staleness or hash mismatch. Bridge lifecycle flows (useBridging.openBridgeExperienceandresetBridgeState) now clear relevant cache entries.Requests to the bridge API are normalized to only include minimal asset fields in
includeAssetsto keep cache keys stable, and tests were updated/added to assert cache behavior and localforage state.Written by Cursor Bugbot for commit 53538c5. This will update automatically on new commits. Configure here.