Skip to content

Add a collapse-idle action to the sidebar#1210

Open
ponbac wants to merge 2 commits intopingdotgg:mainfrom
ponbac:collapse-idle
Open

Add a collapse-idle action to the sidebar#1210
ponbac wants to merge 2 commits intopingdotgg:mainfrom
ponbac:collapse-idle

Conversation

@ponbac
Copy link

@ponbac ponbac commented Mar 19, 2026

What Changed

  • Added a Collapse idle projects action to the sidebar header.
  • The action collapses expanded projects that are idle (not the active project and no thread status or running terminal) while keeping the currently active project open.

Why

The sidebar can accumulate a lot of expanded projects during normal use. This adds a one-click cleanup path without collapsing the project you are currently in or other projects that still have visible thread activity.

UI Changes

Video:

screenrecording-2026-03-19_16-33-08.mp4

Sorry that the mouse cursor is not visible in the recording.

Screenshot:

image

Added this tiny icon. Open for suggestions on a more fitting icon.

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

Add 'Collapse idle projects' button to the sidebar

  • Adds a FoldVerticalIcon button to the projects header that collapses all expanded projects with no active thread status, no running terminals, and that are not the active project.
  • Introduces collectSidebarNonIdleProjectIds in Sidebar.logic.ts to compute the set of non-idle project IDs from thread status, running terminals, and the active project.
  • Thread status and terminal running state are now computed once per render via memoized maps/sets, replacing per-item checks during rendering.

Macroscope summarized 3480f72.


Note

Low Risk
Low risk UI/state change: adds a new sidebar action that programmatically toggles project expansion based on computed thread/terminal activity, with minimal impact outside the sidebar.

Overview
Adds a “Collapse idle projects” control to the sidebar Projects header, collapsing any expanded projects that are neither the current active project nor associated with threads that have a visible status pill or a running terminal.

Introduces collectSidebarNonIdleProjectIds (with new unit tests) and refactors sidebar rendering to memoize threadStatusById and runningTerminalThreadIds, reusing those computed results both for the collapse behavior and per-thread indicators.

Written by Cursor Bugbot for commit 3480f72. This will update automatically on new commits. Configure here.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 19, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1831722e98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

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: 924080ec-6e61-40af-9b2d-1b32a8d2f640

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.

@ponbac ponbac force-pushed the collapse-idle branch 5 times, most recently from faa7eed to b3123eb Compare March 20, 2026 20:46
@fire17
Copy link

fire17 commented Mar 21, 2026

nice touch , hope they merge

Copy link
Contributor

@cursor cursor bot left a comment

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.

const isActive = routeThreadId === thread.id;
const isSelected = selectedThreadIds.has(thread.id);
const isHighlighted = isActive || isSelected;
const threadStatus = resolveThreadStatusPill({
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant recomputation of thread status in render loop

Low Severity

The new threadStatusById useMemo at line 348 already computes resolveThreadStatusPill (including derivePendingApprovals and derivePendingUserInputs) for every thread. However, the resolveProjectStatusIndicator call inside the projects.map() render loop still recomputes the same values from scratch per thread. This call site could simply read from threadStatusById (e.g., projectThreads.map(t => threadStatusById.get(t.id) ?? null)) instead of duplicating the work.

Additional Locations (1)
Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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.

2 participants