feat: collapse-all button for projects sidebar#2307
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate eda2e61
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.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
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
|
@basmilius is attempting to deploy a commit to the Ping Labs Team on Vercel. A member of the Team first needs to authorize it. |
Port collapse-all shortcut from PR pingdotgg#2307 per maintainer request. Co-authored-by: Bas Milius <basmilius@users.noreply.github.com>
Port collapse-all shortcut from PR pingdotgg#2307 per maintainer request. Co-authored-by: Bas Milius <978257+basmilius@users.noreply.github.com>

What Changed
Collapse all projectsicon button in the sidebar's Projects section header, next to the existing sort and add-project buttons.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
After
Checklist
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
collapseAllProjectspure function in uiStateStore.ts that sets all tracked and supplied project IDs to collapsed, with structural sharing when no change is needed.Macroscope summarized b3fb8d6.