Skip to content

feat: collapse-all button for projects sidebar#2307

Closed
basmilius wants to merge 9 commits into
pingdotgg:mainfrom
basmilius:feat/collapse-all-projects
Closed

feat: collapse-all button for projects sidebar#2307
basmilius wants to merge 9 commits into
pingdotgg:mainfrom
basmilius:feat/collapse-all-projects

Conversation

@basmilius

@basmilius basmilius commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • New Collapse all projects icon button in the sidebar's Projects section header, next to the existing sort and add-project buttons.
  • Option/Alt+click on a project triggers the same collapse-all behavior (Finder-style shortcut).
  • One pure function + one action added to uiStateStore (collapseAllProjects). Collapse state persists via the existing localStorage layer without any schema change.

Closes #2306.

Why

With a lot of projects in the sidebar there's no way to quickly reset the tree to a clean state. Power users now get a one-click "collapse all" matching the VS Code file-explorer pattern referenced in the issue. The Alt+click variant gives keyboard-heavy users a way to trigger the same thing without hunting for the header button.

UI Changes

Before

image

After

image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Low risk UI/state update: adds a new sidebar action and store helper to set all project rows collapsed, with minor interaction changes (Alt/Option+click) and persistence coverage via tests.

Overview
Adds a “Collapse all projects” control to the sidebar Projects header (disabled when already fully collapsed) and an Alt/Option+click shortcut on a project row to trigger the same behavior.

Introduces uiStateStore.collapseAllProjects (pure function + Zustand action) to mark supplied logical project keys as collapsed while preserving structural sharing, and adds tests covering no-op behavior, logical-vs-physical key safety, thread-state non-interference, and persistence/rehydration of the resulting collapsed state.

Reviewed by Cursor Bugbot for commit b3fb8d6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add collapse-all button to projects sidebar

  • Adds a 'Collapse all projects' toolbar button to the sidebar header that collapses all projects at once; the button is disabled when all projects are already collapsed.
  • Introduces a collapseAllProjects pure function in uiStateStore.ts that sets all tracked and supplied project IDs to collapsed, with structural sharing when no change is needed.
  • Alt-clicking any project in the sidebar also triggers collapse-all instead of toggling that project individually.

Macroscope summarized b3fb8d6.

Closes pingdotgg#2306. Option/Alt+click on a project chevron triggers the
same collapse-all behavior as the new header button.
Alt+click anywhere on a project row now triggers collapse-all, not
just the chevron. Matches what users expect when the whole row is
the click target for toggling.
@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f029a3ae-0d6a-4c24-a2e9-711e94b20871

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Apr 23, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 23, 2026
@macroscopeapp

macroscopeapp Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp Bot dismissed their stale review April 23, 2026 13:52

Dismissing prior approval to re-evaluate eda2e61

Comment thread apps/web/src/uiStateStore.ts
Fixes issue where collapseAllProjects only collapsed projects already in
projectExpandedById, missing projects with implicit expanded state. Now
iterates over both projectOrder and existing tracked projects to ensure
all projects are collapsed.

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9531315. Configure here.

Comment thread apps/web/src/uiStateStore.ts
Comment thread apps/web/src/uiStateStore.ts Outdated
basmilius added 3 commits May 1, 2026 11:40
Previously collapseAllProjects unioned state.projectOrder (physical
keys) with Object.keys(state.projectExpandedById) (logical keys),
polluting projectExpandedById with physical-key entries that the UI
never reads when grouping is active. The recordsEqual no-op also broke
in that scenario, causing unnecessary re-renders after each
syncProjects.

Make the contract explicit: callers pass the logical project IDs they
want collapsed. Sidebar derives them from sortedProjects (memoized) and
wraps the action so both the header button and Alt+click on a project
trigger the same behavior. Adds a regression test covering the
physical/logical key mix-up.
# Conflicts:
#	apps/web/src/uiStateStore.test.ts
@vercel

vercel Bot commented May 4, 2026

Copy link
Copy Markdown

@basmilius is attempting to deploy a commit to the Ping Labs Team on Vercel.

A member of the Team first needs to authorize it.

@juliusmarminge

Copy link
Copy Markdown
Member

Closing as part of an open-PR triage — same control as #2308, which is currently mergeable, so we're keeping that one for issue #2306. The Option/Alt-click collapse behavior here is a nice touch worth porting over. Thanks!

kyziq added a commit to kyziq/t3code that referenced this pull request Jun 11, 2026
Port collapse-all shortcut from PR pingdotgg#2307 per maintainer request.

Co-authored-by: Bas Milius <basmilius@users.noreply.github.com>
kyziq added a commit to kyziq/t3code that referenced this pull request Jun 11, 2026
Port collapse-all shortcut from PR pingdotgg#2307 per maintainer request.

Co-authored-by: Bas Milius <978257+basmilius@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Collapse all projects button in sidebar

2 participants