Skip to content

refactor(toolbar): extract button sections into dedicated components#4761

Merged
gregpriday merged 1 commit intodevelopfrom
feature/issue-4736-reduce-toolbar-component
Apr 1, 2026
Merged

refactor(toolbar): extract button sections into dedicated components#4761
gregpriday merged 1 commit intodevelopfrom
feature/issue-4736-reduce-toolbar-component

Conversation

@gregpriday
Copy link
Copy Markdown
Collaborator

Summary

  • Extracted 6 focused component files from Toolbar.tsx's inline buttonRegistry, reducing the file from 1532 to ~1000 lines
  • Each extracted component owns its own Zustand store subscriptions, cutting re-render blast radius to only the stores that component actually needs
  • The buttonRegistry useMemo dependency array shrinks from 52 to 22 items

Resolves #4736

Changes

  • GitHubStatsToolbarButton.tsx (341 lines) — full GitHub stats section with useImperativeHandle for overflow coordination
  • NotificationCenterToolbarButton.tsx (79 lines) — notification centre button
  • ToolbarLauncherButton.tsx (102 lines) — terminal/browser launcher buttons
  • ToolbarPortalButton.tsx (49 lines) — portal button
  • ToolbarProblemsButton.tsx (52 lines) — problems/diagnostics button
  • ToolbarSettingsButton.tsx (105 lines) — settings button
  • Toolbar.tsx reduced accordingly, with imports replacing the inline render functions

Testing

All 159 existing tests pass. Typecheck and lint clean. The existing Toolbar.githubDropdowns.test.ts and Toolbar.shortcuts.test.ts suites were updated to account for the new component boundaries.

- Extract GitHubStatsToolbarButton with useImperativeHandle for overflow coordination
- Extract NotificationCenterToolbarButton with own store subscriptions
- Extract ToolbarLauncherButton for terminal/browser/panel-palette buttons
- Extract ToolbarSettingsButton with context menu and keybinding
- Extract ToolbarProblemsButton with diagnostics shortcut
- Extract ToolbarPortalButton with portal store subscription
- Reduce Toolbar.tsx from 1532 to 1000 lines
- Reduce buttonRegistry useMemo deps from 52 to 22 items
- Update source-level tests to read from new component files
@gregpriday gregpriday force-pushed the feature/issue-4736-reduce-toolbar-component branch from 40812c6 to 0f7daed Compare April 1, 2026 12:25
@gregpriday gregpriday merged commit 31b5f80 into develop Apr 1, 2026
@gregpriday gregpriday deleted the feature/issue-4736-reduce-toolbar-component branch April 1, 2026 12:25
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.

Reduce Toolbar component complexity with section extraction

1 participant