fix(assets-controller): avoid race between ws message and AccountsAPI call - #10030
Open
Kriys94 wants to merge 1 commit into
Open
fix(assets-controller): avoid race between ws message and AccountsAPI call#10030Kriys94 wants to merge 1 commit into
Kriys94 wants to merge 1 commit into
Conversation
Kriys94
force-pushed
the
fix/RaceWSAccountsAPI
branch
from
August 31, 2026 16:33
9eb938b to
4961a5b
Compare
Kriys94
marked this pull request as ready for review
August 31, 2026 16:40
Contributor
|
@Kriys94 any reason why you're not adding something to the changelog md file ? |
salimtb
reviewed
Aug 31, 2026
| forceUpdate: true, | ||
| }).catch((error) => { | ||
| log('Failed to refresh assets after transaction confirmed', { error }); | ||
| log('Failed to refresh assets after transaction event', { error }); |
juanmigdr
approved these changes
Aug 31, 2026
juanmigdr
left a comment
Member
There was a problem hiding this comment.
LGTM! Missing changelog and wondering what happens if WS is off or not working
4 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
Current behavior: WS events were racing with
TransactionController:transactionConfirmedevents. If the AccountsAPI is not updated on time and return wrong response (eg due to cache), then the UI might display wrong balances.https://www.loom.com/share/f17458c8da2c48efa4e9cfca9bab79e8
New Behavior: Fully rely on WS message when the chain is active with Websocket
https://www.loom.com/share/19a56758f6804f569ee60f1b825b5ff6
References
Checklist
Note
Medium Risk
Changes when balances refresh after transactions on WS-enabled chains; wrong gating could leave stale balances or skip needed pre-confirm updates on non-WS chains.
Overview
Stops transaction-driven force
getAssetsrefreshes on chains where AccountActivity already pushes live WebSocket balance updates, so Accounts API/cache responses no longer race ahead of WS and overwrite correct balances in the UI.#onUnapprovedTransactionAddedand#onTransactionConfirmedare merged into#refreshAssetsForTransaction, which still force-refreshes the sender’s account on that chain when AccountActivity is not active (e.g. gas estimation on unapproved txs). Tests cover unapproved-tx refresh and the no-op path afterAccountActivityService:statusChangedmarks the chain active.Reviewed by Cursor Bugbot for commit 4961a5b. Bugbot is set up for automated code reviews on this repo. Configure here.