Add expand and collapse all to the sidebar - #271
Conversation
|
@n00ki is attempting to deploy a commit to the bholmesdev's projects Team on Vercel. A member of the Team first needs to authorize it. |
4d1bcce to
df3607f
Compare
There was a problem hiding this comment.
Overview
Adds a sidebar header control to expand/collapse all folders via useSidebarTree, with compaction-aware folder IDs, workspace-scoped persistence, and tests for the main nested and empty cases.
Concerns
None. Expand/collapse walks the same compacted folder IDs as flattenRows, so nested chains stay consistent. Button label/icon track visible expanded state; action is hidden when there are no folders. Hook tests cover expand→collapse and the no-folder case.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Reviewed by a Warp Factory agent.
There was a problem hiding this comment.
Overview
Adds a sidebar header control to expand/collapse all folders via useSidebarTree.toggleAllFolders, with compaction-aware folder IDs (all chain segments), workspace-scoped persistence, startTransition for the bulk update, and hook tests for nested expand/collapse, the empty-folder case, and compacted-chain shape changes.
Concerns
None. Expand walks the same compacted tree as flattenRows and stores every segment id, so nested and later-uncompacted chains stay consistent. Button label/icon track visible expanded state; control is hidden when there are no folders. Prior expand/collapse split was simplified to a single toggle without regressing behavior.
Pre-verdict audit
- Comments: Diff adds no doc/inline comments.
- Tests: New hook tests match existing
renderTreeharness style and cover the distinct paths (full toggle, no folders, compaction shape change).
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Reviewed by a Warp Factory agent.
Description
Add a state-aware sidebar header action for expanding or collapsing every Folder at once. The shared tree hook accounts for nested and compacted Folder paths, preserves the existing workspace-scoped expansion state, and hides the action when there are no Folders.
The button follows established file-explorer behavior: it offers collapse-all whenever a visible Folder is open, otherwise it offers expand-all. Its Mingcute icon, tooltip, and accessible label always describe the next action.
Closes #270
Type of Change
Testing
Manual Testing Details:
Ran the Electron playground and verified expand-all and collapse-all with real pointer input. Confirmed nested files appear and disappear, the icon and accessible label change in both directions, local storage updates for the open Folder, and expanded state restores after a renderer reload.
Automated checks:
pnpm --filter @hubble.md/ui testpnpm checkpnpm check:react-compilerpnpm build:desktopChecklist