feat(sidebar): pin chats within projects#4047
Conversation
Persist pinned thread keys per logical project, keep pinned chats above the project's normal sort order, and separate pinned chats with a compact divider.
Track row hover and focus directly instead of relying on nested group selectors, and hide row actions while a thread drag is active.
Render the pinned divider during active drags when all threads are in one group, allowing the first pin and last unpin gestures to cross a measurable boundary.
Prevent drag activation from interactive controls, preserve mobile row metadata beside actions, and keep scoped active threads visible in collapsed previews.
Overlay the temporary divider when only pinned or unpinned threads exist so mounting it during a drag does not shift the active row.
|
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort 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 e42b031. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces a new user-facing feature (pinning chats within projects) with drag-and-drop interactions, new UI components, and new persisted state. New features with user-facing behavior changes warrant human review. You can customize Macroscope's approvability policy. Learn more. |

What Changed
Why
Important chats should stay easy to reach without being pinned globally across unrelated projects. Project-scoped pinning keeps each sidebar group predictable while preserving the existing thread sort order for unpinned chats.
The hover control provides a quick direct action, while divider-crossing drag behavior makes sidebar organization feel natural.
Validation
vp checkvp run typecheckvp test apps/web/src/components/Sidebar.logic.test.ts apps/web/src/uiStateStore.test.ts— 81 tests passedUI Changes
Interaction demo:
Screen.Recording.2026-07-12.at.11.51.13.PM.mp4
Replaces #3913, whose head accidentally tracked the fork's long-lived
mainbranch.Note
Add pin/unpin support for chat threads within sidebar projects
SidebarProjectThreadList.uiStateStoreand persisted to localStorage viapinnedThreadKeysByProject.prioritizeThreadsByPinnedKeys,resolveThreadPinCrossingAction,shouldShowPinnedThreadDivider,shouldBlockThreadDragActivation) handle ordering, drag state, and divider rendering.getVisibleThreadsForProjectnow accepts optionalgetThreadId/isThreadAlwaysVisibleparams;hasHiddenThreadsnow reflects whether threads are actually hidden rather than whether the list exceeds the limit.Macroscope summarized 16a5331.
Note
Low Risk
Client-only UI state in localStorage and sidebar interaction logic; no auth or server data changes.
Overview
Adds project-scoped thread pinning in the sidebar: pinned chats stay at the top of each project (after the normal sort), persist in
pinnedThreadKeysByProjectviauiStateStore, and remain visible when the thread list is folded.Pin/unpin UX: hover pin controls on each row (with desktop row-action visibility tweaks via
shouldHideThreadMeta), plus drag across a pinned divider (DndContext/useDraggable) with divider coloring fromresolveThreadPinCrossingAction. Drag does not start from buttons/inputs (shouldBlockThreadDragActivation); clicks are suppressed after a drag.Logic:
prioritizeThreadsByPinnedKeys, divider visibility helpers, and an extendedgetVisibleThreadsForProject(scoped keys,isThreadAlwaysVisiblefor pins) drive list rendering and jump/preview behavior.Reviewed by Cursor Bugbot for commit 16a5331. Bugbot is set up for automated code reviews on this repo. Configure here.