Skip to content

Add expand and collapse all to the sidebar - #271

Open
n00ki wants to merge 3 commits into
bholmesdev:mainfrom
n00ki:feat/expand-collapse
Open

Add expand and collapse all to the sidebar#271
n00ki wants to merge 3 commits into
bholmesdev:mainfrom
n00ki:feat/expand-collapse

Conversation

@n00ki

@n00ki n00ki commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

Testing

  • Existing tests pass
  • Added new tests for changes
  • Tested manually (describe below)

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 test
  • pnpm check
  • pnpm check:react-compiler
  • pnpm build:desktop

Checklist

  • I discussed this change in a GitHub issue before submitting this PR
  • I have run the linter, formatter, and tests to ensure my code is ready for review

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@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.

@n00ki
n00ki force-pushed the feat/expand-collapse branch from 4d1bcce to df3607f Compare August 17, 2026 08:46

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 renderTree harness 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.

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.

Expand or collapse all sidebar folders at once

1 participant