-
-
Notifications
You must be signed in to change notification settings - Fork 273
fix: avoid making unnecessary api calls #7811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
|
@cursor update the assets Changelog to cater for the changes in my PR |
|
I've successfully updated the assets-controllers changelog to document the changes from your PR. Here's what I added: Updated: Added to [Unreleased] section:
The changelog entry properly documents the performance optimizations your PR introduces, including the deduplication of concurrent API calls, improved caching behavior, and the new reset functionality. The changes have been committed and pushed to the |
Co-authored-by: juan.gutierrez <juan.gutierrez@consensys.net>


Explanation
Updated the code so that we do not make subsequent API calls to the same endpoint with the same params and so that we cache the response to avoid unnecessary re-fetching
References
https://consensyssoftware.atlassian.net/browse/ASSETS-2582
Checklist
Note
Medium Risk
Changes caching/refresh behavior for supported networks/currencies, which could lead to stale capability lists if callers relied on the previous always-refresh-in-background behavior. Concurrency deduping is low risk but touches shared request paths used by price and exchange-rate polling.
Overview
Improves Price API call efficiency by deduplicating concurrent
fetchSupportedNetworks()requests via an in-flight promise cache, and clearing that promise on completion/reset.Reduces background metadata traffic by only triggering non-blocking refreshes of supported networks/currencies from
fetchTokenPrices()/fetchExchangeRates()when no cached value exists, and adds a unit test ensuring concurrentsupportedNetworkscalls collapse to a single HTTP request (plus changelog entry).Written by Cursor Bugbot for commit 21e4322. This will update automatically on new commits. Configure here.