feat: bypass Accounts API server cache after transaction confirmation - #10068
feat: bypass Accounts API server cache after transaction confirmation#10068salimtb wants to merge 4 commits into
Conversation
…action confirmation The Accounts API keeps a 60s server-side cache keyed on the full URL, and WebSocket events do not invalidate it, so a refresh right after a transaction confirms can be answered with the pre-transaction snapshot. forceUpdate only skips the client-side query cache. getAssets now accepts a bypassCache option; when set, AccountsApiDataSource asks the core-backend client to append a random cacheBuster query param (the mechanism sanctioned by the API team so these requests stay traceable in logs) and skip the client-side cache. The transaction-confirmed refresh passes it; the unapproved-transaction refresh intentionally does not, to keep cache misses rare.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@cursor fix conflicts |
|
Perfect! I've successfully resolved the merge conflicts on your PR. Here's what I did: SummaryI resolved the merge conflict in What was conflictingBoth branches had added entries to the Fixed section under Unreleased in the changelog:
ResolutionI kept both changelog entries since they fix different issues:
The merge has been committed and pushed successfully. Your PR is now up to date with main and ready for review. |
…irmed Co-authored-by: Salim TOUBAL <salimtb@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a26b9fb. Configure here.



The Accounts API keeps a 60s server-side cache keyed on the full URL, and WebSocket events do not invalidate it, so a refresh right after a transaction confirms can be answered with the pre-transaction snapshot. forceUpdate only skips the client-side query cache.
getAssets now accepts a bypassCache option; when set, AccountsApiDataSource asks the core-backend client to append a random cacheBuster query param (the mechanism sanctioned by the API team so these requests stay traceable in logs) and skip the client-side cache. The transaction-confirmed refresh passes it; the unapproved-transaction refresh intentionally does not, to keep cache misses rare.
Explanation
References
Checklist
Note
Low Risk
Scoped opt-in cache busting on balance fetches, mainly after transaction events; no auth or persistence changes, with unit test coverage for URL param behavior.
Overview
Fixes stale balances right after a transaction when
forceUpdateonly skipped the client TanStack cache but the Accounts API still served a 60s server-side snapshot (WebSocket updates do not invalidate that cache).core-backendadds optionalbypassServerCacheonFetchOptions. For v5/v6 multi-account balance calls, it forcesstaleTime: 0and appends a fresh randombypassServerCachequery param so the API cache keys miss.assets-controllerthreads the flag throughDataRequest→getAssets→AccountsApiDataSource, and transaction-driven refreshes (#refreshAssetsForTransaction, used for both confirmed and unapproved transaction events) callgetAssetswithforceUpdateandbypassServerCache: true. Tests cover the data source and API client wiring.Reviewed by Cursor Bugbot for commit cfda0d6. Bugbot is set up for automated code reviews on this repo. Configure here.