Spec: Fowler-style refactoring review (cloud agent, 2026-08-05). Refactor only — no behavior change.
Blocked by: #148
What to change
components/desk-workspace.tsx is 1,846 lines; the DeskWorkspace body alone is ~1,100 and owns routing, data loading, a keyboard state machine, swipe gestures, filtering, search, day grouping, trash undo, scroll restoration, and the render for both phone and desk surfaces (Large Class / Divergent Change).
Split along the change axes:
useThreadViews — the generation-guarded loader (load, loadGeneration, the changeable-thread refresh logic, ~782–865) plus the artifacts/projects loading.
useDeskKeyboard — the j/k/r/n/x/#/g queue machine with its five refs, stepOffRow, fileFocused, and the keydown effect (~1087–1316).
useSwipeNavigation — the touch handlers and openAdjacentThread (~1108–1342).
useScrollRestore — the phone list-scroll save/restore effects (~1483–1498).
- Extract components —
DayCards (~1401–1478) and the stacks list render (~1659–1717).
ThreadRow takes 16 props, several of them flag arguments serving four different call sites — introduce a props object or split the row into desk/phone variants; also extract the twice-written latestMentions(view) mapping (in toFacetThread and the candidates memo).
Out of scope: lib/desk/facets.ts internals; visual or interaction changes; ThreadChat (own ticket).
Acceptance criteria
Spec: Fowler-style refactoring review (cloud agent, 2026-08-05). Refactor only — no behavior change.
Blocked by: #148
What to change
components/desk-workspace.tsxis 1,846 lines; theDeskWorkspacebody alone is ~1,100 and owns routing, data loading, a keyboard state machine, swipe gestures, filtering, search, day grouping, trash undo, scroll restoration, and the render for both phone and desk surfaces (Large Class / Divergent Change).Split along the change axes:
useThreadViews— the generation-guarded loader (load,loadGeneration, the changeable-thread refresh logic, ~782–865) plus the artifacts/projects loading.useDeskKeyboard— the j/k/r/n/x/#/g queue machine with its five refs,stepOffRow,fileFocused, and the keydown effect (~1087–1316).useSwipeNavigation— the touch handlers andopenAdjacentThread(~1108–1342).useScrollRestore— the phone list-scroll save/restore effects (~1483–1498).DayCards(~1401–1478) and the stacks list render (~1659–1717).ThreadRowtakes 16 props, several of them flag arguments serving four different call sites — introduce a props object or split the row into desk/phone variants; also extract the twice-writtenlatestMentions(view)mapping (intoFacetThreadand thecandidatesmemo).Out of scope:
lib/desk/facets.tsinternals; visual or interaction changes;ThreadChat(own ticket).Acceptance criteria
desk-workspace.tsxis a composition shell; each extracted hook/component has one responsibility and lives in its own filemise run lintandmise run testpass (desk keyboard, filing, trash/undo, and facet specs unchanged)