fix(accounts-controller): fix clearState not sending removed account events - #10150
Open
ccharly wants to merge 3 commits into
Open
fix(accounts-controller): fix clearState not sending removed account events#10150ccharly wants to merge 3 commits into
clearState not sending removed account events#10150ccharly wants to merge 3 commits into
Conversation
ccharly
marked this pull request as ready for review
September 9, 2026 15:13
clearState not sending removed account events
ccharly
temporarily deployed
to
default-branch
September 9, 2026 15:13 — with
GitHub Actions
Inactive
gantunesr
approved these changes
Sep 10, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 10, 2026
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
clearStatewas not sending those events, which could have resulted in non-symmetrics events foraccount*{Added,Removed}, making it hard for consumers that want to rely on granular account operations.References
Checklist
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
clearStatepreviously reset account state without notifying listeners, unlike other removal paths that emitAccountsController:accountRemovedandAccountsController:accountsRemoved.After capturing IDs from the current state, it still resets to defaults, then publishes one
accountRemovedper cleared account and a singleaccountsRemovedbatch 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.