Skip to content

perf(account-tree-controller): use batched account events#8160

Merged
ccharly merged 1 commit intomainfrom
cc/feat/account-tree-use-batch-events
Mar 10, 2026
Merged

perf(account-tree-controller): use batched account events#8160
ccharly merged 1 commit intomainfrom
cc/feat/account-tree-use-batch-events

Conversation

@ccharly
Copy link
Contributor

@ccharly ccharly commented Mar 10, 2026

Explanation

Use new :accounts{Added,Removed} events from the AccountsController.

References

N/A

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

Medium Risk
Switching from single-account to batched AccountsController events changes the controller’s event contract and could cause missed tree/selection updates if any publisher/consumer still emits or expects the old events. Batched removal also changes when selectedAccountGroupChange is emitted, so regressions would show up as incorrect auto-selection after removals.

Overview
Account add/remove handling is migrated to the new batched AccountsController:accountsAdded / accountsRemoved events. The controller now filters out already-known accounts/unknown removals and performs inserts/removals within a single update call, emitting AccountTreeController:accountTreeChange once per batch.

Selection-change emission is adjusted for batched removals. selectedAccountGroupChange is now published only after the batch update when the selected group actually differs from the pre-batch value.

Tests, messenger mocks, and AllowedEvents typings are updated to use the new event names/payload shapes, and the package changelog notes the change.

Written by Cursor Bugbot for commit a4507b3. This will update automatically on new commits. Configure here.

@ccharly ccharly marked this pull request as ready for review March 10, 2026 11:28
@ccharly ccharly requested a review from a team as a code owner March 10, 2026 11:28
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@ccharly ccharly force-pushed the cc/feat/account-tree-use-batch-events branch 2 times, most recently from fe2427d to 79aed9e Compare March 10, 2026 12:28
@ccharly ccharly requested a review from a team as a code owner March 10, 2026 12:28
@ccharly ccharly force-pushed the cc/feat/account-tree-use-batch-events branch from 79aed9e to e41ba68 Compare March 10, 2026 13:37
@ccharly ccharly force-pushed the cc/feat/account-tree-use-batch-events branch from e41ba68 to a4507b3 Compare March 10, 2026 16:24
"packages/account-tree-controller/src/AccountTreeController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 10
"count": 8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@ccharly ccharly added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit fab44f0 Mar 10, 2026
635 of 637 checks passed
@ccharly ccharly deleted the cc/feat/account-tree-use-batch-events branch March 10, 2026 20:11
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