Skip to content

fix: skip no-op AssetsController state assignments - #10223

Open
salimtb wants to merge 2 commits into
mainfrom
fix/assets-controller-skip-noop-statechange
Open

salimtb wants to merge 2 commits into
mainfrom
fix/assets-controller-skip-noop-statechange

Conversation

@salimtb

@salimtb salimtb commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Explanation

Repeated asset polls often return the same metadata, balances, and prices as objects with new identities. #updateState assigned those values unconditionally, so Immer recorded patches even when every field was already in state. BaseController.update() then published stateChange, which hosts persist.

This skips assignment when the computed next value is deep-equal to the current slice. No-op polls no longer produce patches or stateChange; a real amount/price/metadata change still publishes once.

References

N/A — host-side persistence cost from identical AssetsController updates.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Made with Cursor

Avoid writing deep-equal metadata, balances, and prices so Immer does not emit patches that publish identical stateChange events.
@salimtb
salimtb requested review from a team as code owners September 14, 2026 10:11
@salimtb salimtb self-assigned this Sep 14, 2026
@salimtb
salimtb deployed to default-branch September 14, 2026 10:11 — with GitHub Actions Active
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant