Skip to content

refactor(desktop): split sidebar/index.tsx god file into focused modules - #55453

Merged
OutThisLife merged 1 commit into
mainfrom
bb/desktop-split-sidebar
Jun 30, 2026
Merged

refactor(desktop): split sidebar/index.tsx god file into focused modules#55453
OutThisLife merged 1 commit into
mainfrom
bb/desktop-split-sidebar

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

Second in the apps/desktop god-file split series. Breaks the 1,963-line src/app/chat/sidebar/index.tsx into the directory's existing sibling-module convention. index.tsx now holds only the ChatSidebar component: 1,963 → 1,416 lines.

Changes

  • order.ts — adds the pure reorder helpers orderByIds, reconcileOrderIds, sameIds alongside the existing ones (+ unit tests in order.test.ts)
  • reorderable-list.tsx (new) — the generic ReorderableList + useSortableBindings DnD primitive (and its Y-only auto-scroll constant)
  • section-states.tsx (new) — SidebarSessionSkeletons, SidebarBlankState, SidebarPinnedEmptyState
  • sessions-section.tsx (new) — SidebarSectionHeader, the large SidebarSessionsSection renderer, and the Sortable* row wrappers

Notes

  • Pure restructuring — no behavior change. Code moved verbatim; only imports/exports adjusted.
  • Module boundaries are acyclic: order / reorderable-list / section-states are leaves; sessions-section depends on them + the existing projects / session-row / virtual-session-list; index.tsx composes everything.
  • ChatSidebar is exported unchanged; its single consumer's import path is untouched.

Test plan

  • npm run typecheck (desktop) — passes
  • eslint on all changed/added files — clean
  • vitest run for order.test.ts (existing + new helper tests) — 10 pass
  • Smoke-test the sidebar: recents/pinned/messaging/cron sections, project overview drill-in, drag-to-reorder, virtualized long list, search results, blank/empty states

Note: a whole-tree npm run lint reports 4 pre-existing errors in unrelated files on main; none are touched here.

Behavior-preserving extraction of the 1,963-line ChatSidebar file into the
existing sidebar/ sibling-module convention:

- order.ts: add pure orderByIds / reconcileOrderIds / sameIds helpers (+ tests)
- reorderable-list.tsx: the generic ReorderableList + useSortableBindings DnD
  primitive
- section-states.tsx: SidebarSessionSkeletons / SidebarBlankState /
  SidebarPinnedEmptyState
- sessions-section.tsx: SidebarSectionHeader + the large SidebarSessionsSection
  renderer + its sortable row wrappers

index.tsx now holds only the ChatSidebar component (1,963 -> 1,416 lines).
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Jun 30, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary\n\nVerdict: LGTM\n\nSecond in the desktop god-file split series. sidebar/index.tsx reduced from 1,963 to 1,416 lines. 6-file change with clean module boundaries and 10 unit tests for order helpers.\n\n### Looks Good\n- Pure restructuring with no behavior change\n- Acyclic module dependencies\n- Comprehensive test coverage for the reorder helpers\n---\nReviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review: LGTM

Splits the sidebar index.tsx god file into focused modules: ReorderableList, orderByIds, reconcileOrderIds, sameIds moved to order.ts; SidebarSectionHeader, SidebarSessionSkeletons, SidebarBlankState, SidebarPinnedEmptyState moved to section-states.ts; SidebarSessionsSection moved to sessions-section.ts. This is a classic god-file reduction -- the parent component is now a clean orchestrator. File count (6) and additions (608) are well within scope for a structural refactor.

Verdict: LGTM -- clean decomposition of a god file.

@OutThisLife
OutThisLife merged commit 6121196 into main Jun 30, 2026
22 checks passed
@OutThisLife
OutThisLife deleted the bb/desktop-split-sidebar branch June 30, 2026 07:18
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…lit-sidebar

refactor(desktop): split sidebar/index.tsx god file into focused modules
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…lit-sidebar

refactor(desktop): split sidebar/index.tsx god file into focused modules
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…lit-sidebar

refactor(desktop): split sidebar/index.tsx god file into focused modules
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…lit-sidebar

refactor(desktop): split sidebar/index.tsx god file into focused modules
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…lit-sidebar

refactor(desktop): split sidebar/index.tsx god file into focused modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants