fix(AssetsController): Clean code (#7867) #7880
Draft
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
References
Checklist
changed
Note
Medium Risk
Touches core subscription/chain-assignment logic and introduces a
breaking API contract for data-source callbacks, which could cause missed subscriptions or runtime errors if any caller isn’t updated.
Overview
Breaking change:
handleActiveChainsUpdate(dataSourceId, activeChains, previousChains)and theonActiveChainsUpdatedcallback now requirepreviousChains, and all balance data sources were updated/tests adjusted to pass both the source name and previous chain list.Refactors subscription management to stop tracking per-source chains
in
AssetsControllerand instead assign chains by querying each data source’sgetActiveChainsSync()in a fixed priority order;registerDataSources/assignment helpers are removed, unsubscribe logic now operates on data source instances, and docs are updated accordingly. Also fixesRpcDataSourceto update its internal/stateactiveChainsbefore firing the callback so sync reads during resubscribe see the new chains.Written by Cursor
Bugbot for commit 509e716. This will update automatically on new commits. Configure
here.
Explanation
References
Checklist