Skip to content

fix(accounts-controller): fix clearState not sending removed account events - #10150

Open
ccharly wants to merge 3 commits into
mainfrom
cc/fix/accounts-controller-missing-events-on-clear-state
Open

fix(accounts-controller): fix clearState not sending removed account events#10150
ccharly wants to merge 3 commits into
mainfrom
cc/fix/accounts-controller-missing-events-on-clear-state

Conversation

@ccharly

@ccharly ccharly commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Explanation

clearState was not sending those events, which could have resulted in non-symmetrics events for account*{Added,Removed}, making it hard for consumers that want to rely on granular account operations.

References

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

Note

Low Risk
Small, targeted event emission fix on a deprecated reset path; may cause downstream listeners to run cleanup they previously skipped on clearState.

Overview
clearState previously reset account state without notifying listeners, unlike other removal paths that emit AccountsController:accountRemoved and AccountsController:accountsRemoved.

After capturing IDs from the current state, it still resets to defaults, then publishes one accountRemoved per cleared account and a single accountsRemoved batch when anything was removed; empty state stays a no-op for those events.

Tests cover per-id and batch publishing and the empty-state case; the package changelog records the fix under Fixed.

Reviewed by Cursor Bugbot for commit 2ba26a6. Bugbot is set up for automated code reviews on this repo. Configure here.

@ccharly
ccharly marked this pull request as ready for review September 9, 2026 15:13
@ccharly
ccharly requested review from a team as code owners September 9, 2026 15:13
@ccharly ccharly changed the title fix(accounts-controller): fix clearState not sending removed account events fix(accounts-controller): fix clearState not sending removed account events Sep 9, 2026
@ccharly
ccharly added this pull request to the merge queue Sep 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 10, 2026
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.

2 participants