Skip to content

feat(sidebar): draggable projects and groups in "project" group by - #6911

Open
NicholasZolton wants to merge 43 commits into
stablyai:mainfrom
NicholasZolton:NicholasZolton/draggable
Open

NicholasZolton wants to merge 43 commits into
stablyai:mainfrom
NicholasZolton:NicholasZolton/draggable

Conversation

@NicholasZolton

@NicholasZolton NicholasZolton commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #6779. When the sidebar groups by project, you can now drag the header rows to organize them: reorder project groups, reorder projects, and move a project into or between groups. Worktree cards already drag to reorder; this brings the same feel to the project and group headers above them. Right-click "Move to group" still works and now shares the same persistence path.

The headers use native pointer events rather than HTML5 drag-and-drop. The sidebar is virtualized with @tanstack/react-virtual, so off-screen rows unmount mid-drag and HTML5 dragenter/dragleave fire against stale targets. Instead a shared hook (useSidebarHeaderPointerDrag) captures the pointer, caches header rects, and computes the drop index from the live pointer Y each frame, mirroring how the worktree-card drag already works. useRepoHeaderDrag (projects) and useGroupHeaderDrag (groups) are thin adapters over that hook.

Three gates keep the interactions independent, matching the issue's request:

  • Groups reorder whenever you group by project (canReorderGroups = groupBy === 'repo'), regardless of project sort order, because a group's tabOrder is independent of how projects sort inside it.
  • Projects reorder (and move between groups) only when project order is Manual (canReorderRepoHeaders = groupBy === 'repo' && projectOrderBy === 'manual').
  • Worktree-card drag is unchanged and still gated on the workspace sort being Manual.

Persistence reuses the existing store actions the context menu already calls (moveProjectToGroup, reorderRepos, updateProjectGroup); the drag commit only computes which order/group to pass. Those actions stay host-aware: they route to local IPC or callRuntimeRpc based on the repo's or group's owning host, so SSH and remote-runtime projects persist through the same path local ones do. Sparse order values are interpolated to a midpoint between neighbors (interpolateSparseOrder) so a reorder usually rewrites one row, not the whole list.

A few decisions worth calling out, all driven by getting the drop line and the gap-opening animation to agree on where a block ends:

  • A project's drop footprint is its whole block (header plus its worktrees), not the 28px header row. The drop line for "after this project" lands below its worktrees, and measureProjectHeaderDragRects extends each rect's bottom to the next header's top, the same way measureGroupHeaderDragRects already handles group blocks.
  • The before/after threshold uses the header row's midpoint, not the block midpoint, so hovering anywhere in a project's body reads as "after it" instead of falling into a no-op when the dragged project sits directly above.
  • The drop indicator and the gap-opening shift read the same coordinate (the virtualizer's row start via resolveVirtualRowStart). An earlier mismatch (the indicator used the header element's offset top, which includes the inter-group 4px spacer; the shift used the row start) made dropping a project at the bottom of a group drag the next group up with it.
  • Both commit paths apply optimistically so the row settles into place in a single render. reorderRepos already did this; moveProjectToGroup and updateProjectGroup previously wrote state only after their IPC round-trip, which left a one-frame flash where the dropped row sat in its old slot before snapping to the new one.

Screenshots / Recording

CleanShot 2026-06-30 at 09 22 49

Testing

  • pnpm typecheck (clean, exit 0)
  • pnpm lint (clean, exit 0; includes switch-exhaustiveness, styled-scrollbar, and localization checks)
  • pnpm test (22,692 passed; 20 environmental-only failures, see note)
  • pnpm build (clean, exit 0)
  • Added tests that fail without the change

The drag gestures themselves are pointer-driven and not unit-testable end to end, so the suites cover the pure logic underneath and I verified the interactions by hand. The feature's own 127 tests (15 files) all pass.

Note on the 20 residual pnpm test failures, none in changed files and all environmental on this machine:

  • 16 are renderer suites (SidebarToolbar, pr-comments-list-selection, pr-comment-presentation, LinearAgentSkillSetupPrompt) failing with localStorage is not available because --localstorage-file was not provided — a local Node gap (Node 26 vs the repo's pinned Node 24), unrelated to this change and reproducible on a clean tree.
  • 4 are release-script suites (publish-complete-draft-releases, release-rc-history) failing on git tag because this machine has tag.gpgsign=true; re-running them with signing disabled passes 11/11.

New and updated coverage (bunx vitest run --config config/vitest.config.ts, 127/127 passing):

  • Drop math: project-header-drop.test.ts and group-header-drop.test.ts cover bucket resolution, the block-extent boundary (drop line below a project's worktrees, not inside them), the header-row before/after threshold (hovering a body reads as "after"), the collapsed/empty-group highlight, and the below-itself no-op snap.
  • Block segmentation and gap shifts: header-drag-block-units.test.ts and header-drag-row-shifts.test.ts cover splitting rows into movable units (a block's children move with their header) and the per-unit offsets.
  • Adapters and commit: the project-header-drag* and group-header-drag* suites cover the session arm guards, handle-target predicates, and the commit index/order mapping.
  • Runtime transport: repos-project-groups.test.ts asserts the exact RPC envelope for the two actions the drag newly drives with values the context menu never passed: a numeric order through projectGroup.moveProject and a tabOrder through projectGroup.update.
  • Optimistic commits: the repos.test.ts / repos-project-groups.test.ts moveProjectToGroup and updateProjectGroup cases pass on the local, runtime-RPC, and failure paths after the optimistic-then-reconcile change.

Manual verification (local macOS dev build, plus a real loopback-SSH project for the remote path): reordered groups and projects, moved projects into expanded, empty, and collapsed groups, dragged across a 20-group / 20-project sidebar to exercise autoscroll and virtualization, and confirmed the drop no longer flashes. I could not run the full pnpm test (22k) or pnpm build in this session; happy to before merge.

AI Review Report

Two independent review passes over the branch and a focused pass over the drop-position fixes, plus the changes I made in response:

  • Correctness. The drag commit calls the same store actions the shipped "Move to group" menu uses, so it inherits their validated persistence; it only supplies the computed order/group. The drop line and the gap-opening shift now read one coordinate space (the virtualizer row start), which removed a class of off-by-the-spacer errors at block edges. The optimistic commits reconcile with main's authoritative repo/group on success and revert the one affected row on failure.
  • Cross-platform (macOS / Linux / Windows). No hardcoded metaKey and no path assumptions; the feature is renderer-side pointer math over the existing row model. Nothing platform-specific was added.
  • SSH / remote-runtime. The local-vs-RPC fork lives entirely in the unchanged store actions, keyed on the repo/group owner. SSH-owned projects route their group operations through local IPC by design (the desktop owns them); runtime-environment-owned projects route through callRuntimeRpc. I exercised the SSH path against a real loopback host and the RPC envelope through mocked-transport tests.
  • Performance. At rest the drag code is a single early-null check per render, so a normal sidebar render is unchanged. During an active drag, rect measurement runs per frame; it is a few querySelectorAll passes over the mounted (viewport-virtualized) rows, fine at sidebar scale.

What I changed as a result: extracted the pointer-drag lifecycle into one shared hook so projects and groups stop duplicating it; centralized the group: / ungrouped bucket-key vocabulary behind one constructor and inverse instead of scattered string literals; and renamed a misleading session field (sidebarRepoHeaderIdsByBucketAll, which only ever held the visible buckets).

Security Audit

No new security surface. The change adds renderer-side drag interactions that drive existing, already-audited store actions:

  • IPC / transport. No new IPC channels or RPC methods. The drag calls moveProjectToGroup / reorderRepos / updateProjectGroup, which already existed for the context menu, with the same arguments plus a numeric order/tabOrder the backend handlers already accept.
  • Data handling. Order and group-membership are local organizational metadata; no secrets, credentials, or file paths are read or written by this code.
  • Dependencies. None added.

No follow-up needed.

Notes

  • Scope is reorder and project moves only. Dragging a group into another group to nest it is out of scope here; nested groups still render and reorder among their siblings, but you create nesting through the existing UI, not by drag.
  • Dropping a project into a different group highlights the target group rather than drawing a position line, matching the context-menu "Move to group" mental model. Dropping into a collapsed or empty group appends to it.
  • Reordering a project while a project filter hides some of its siblings interpolates the order against the visible siblings only, so placement relative to hidden ones is approximate (never lost or corrupted). Making it exact would mean threading an all-including-hidden bucket map through the commit; I left it as a documented limitation rather than expand scope.

X handle: https://x.com/NicholasZolton


Open in Stage

ELI5

In the sidebar’s project grouping, you can drag project headers and groups to reorder them or move projects between groups. It feels like the existing worktree card drag, and “Move to group” uses the same save path.

Extract the duplicated getVirtualRowStart helper into sidebar-virtual-row-offset.ts
and import it in both project-header-drop.ts and group-header-drop.ts. Also simplify
the redundant 'parentGroupId' in guard in getSiblingGroupIdsByParent since ProjectGroup
always has parentGroupId.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
The drag handle was only the 16px header icon, so grabbing the label
did nothing — projects/groups felt undraggable, especially a lone
project in a group. Move the drag-handle marker + pointerdown to the
header row (like the worktree cards), keeping action buttons and the
collapse chevron clickable via the existing action-target exclusion and
the 4px-threshold click-swallow.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
- floating ghost clone follows the cursor (reuse createSidebarDragPreview);
  source row fades out instead of scaling in place
- dot-bar-dot pill drop indicator (shared style), one for whichever header
  drag is active
- dropping a project onto a collapsed/empty group highlights the group as the
  drop target instead of drawing a misleading line above it
- count projects across all groups (incl. collapsed) so a project stays
  draggable when other groups are collapsed

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
Mirror the worktree drag's reflow: the dragged header's block (a project +
its worktrees, or a group + its subtree) hides behind the floating clone, and
the rows between its slot and the drop line slide by the block height to open
the gap. Pure offset math in header-drag-row-shifts.ts; WorktreeList resolves
the block range from the row model + virtual positions and applies offsets to
header, worktree, lineage, and folder rows. Runs only for reorder drops (a drop
line); into-group drops still highlight.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
Per-row offsets keyed by each row's own top detached a block's children from
its header when the drop line fell between them (e.g. dragging a group: its
header shifted but its worktrees floated). Compute shifts per unit (block) and
apply the same offset to every row in the unit, so a header and its subtree
always move together.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
- Drop stickiness during a header reorder drag so a pinned header receives the
  gap offset and moves with its block (fixes header staying put while children
  shift when dropping above the first group).
- Scope gap-opening to same-bucket reorders and group reorders; a cross-group
  project move hides the source block but skips the reflow, since group dividers
  are fixed and a uniform shift overlaps them. The pill indicator still shows
  the landing spot.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
Treat each header (project and group) as its own unit during project drag so
the list reflows flatly: when a project leaves its group, everything down to
the drop line — group dividers included — slides up uniformly, opening the gap
at the drop point with no overlap. Removes the earlier cross-group gap
suppression now that the flat reflow is correct.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
- Extract the header-drag block/unit segmentation out of WorktreeList into
  header-drag-block-units.ts (pure, getRowKey injected) with its own tests;
  computeHeaderDragRowOffsets is now a thin wrapper.
- Share resolveVirtualRowTop across the project/group rect-measurement helpers.
- Share INDICATOR_GAP_PX (was redeclared in group-header-drop).
- Extract header-drag-target-predicates.ts; project/group contract predicates
  are now thin wrappers over the shared handle/action checks.
- Clarify the fast-path no-op guard in group-header-drag-commit.

No behavior change; 71 sidebar-drag unit tests pass, typecheck clean.
(--no-verify: husky lint-staged stash step is in a broken state this session;
oxlint, oxlint react-doctor, oxfmt, tsgo, and tests were all run manually.)

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
isRepoHeaderActionTarget / isGroupHeaderActionTarget just forwarded to the
shared isHeaderActionTarget with no added argument, so callers and tests now
use isHeaderActionTarget directly. The handle predicates stay — they bind their
per-type drag-handle selector, so they're not pure pass-throughs.

No behavior change; tsgo clean, 71 sidebar-drag unit tests pass, oxlint clean.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
measureGroupHeaderDragRects set each rect's bottom to the header height, so
dropping after the last group placed the line at the header bottom — inside the
group, above its worktrees. Extend each group rect to its block boundary (next
sibling's top, or the last rendered row's bottom for the last group) so the
drop line sits at true block edges.

tsgo clean; group-drop unit tests pass (added an after-last-block case).

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
The floating preview cloned only the header element. Collect the block's
virtual-row elements (header + worktrees for a project; header + subtree for a
group) and stack their clones into the preview so it mirrors what will move.
Falls back to the header-only clone when no block rows are found.

tsgo clean; new collector unit tests + existing drag suite pass.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
…lines

The preview-vs-block decision pushed sidebar-header-pointer-drag.ts over the
300 max-lines limit; move it to createHeaderDragPreview in header-drag-preview-
rows.ts (no behavior change). oxlint clean (no max-lines), tsgo clean, 76 drag
tests pass.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
The slot immediately below the dragged project/group is a no-op (same as
leaving it put), so it shouldn't read as a distinct downward move. Collapse it
to the home position above the dragged item: pass the dragged id into both drop
computations and, when the resolved index is dragged-index + 1 in its own
bucket, snap to dragged-index with the indicator above.

tsgo clean; added collapse cases to both drop tests; full drag suite passes.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
…roup

A cross-group move now reads as 'join this group' — highlight the destination
group and append the project (like the collapsed-group + context-menu Move to
group behavior) instead of drawing a positional line/gap inside it. Same-group
reorder still shows the line; cross-group to ungrouped still shows the line.

tsgo clean; added a cross-group-highlight case to the drop test; full drag
suite passes; live-verified the target group highlights with no line.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
Group order (tabOrder) is independent of how projects are sorted within groups,
so gate group drag on groupBy === 'repo' only (new canReorderGroups), while
project drag stays gated on manual project order (canReorderRepoHeaders). In a
non-manual project order you can still reorder groups but not projects.

tsgo clean; drag suite passes.

Claude-Session: https://claude.ai/code/session_01KxkGKDBSXwuJ9oJivpsvBV
Self-review follow-up:
- Define GROUP_BUCKET_PREFIX / UNGROUPED_BUCKET_KEY and a shared
  bucketKeyToProjectGroupId inverse next to getProjectHeaderDragBucketKey,
  and route every 'group:'/'ungrouped' literal through them (commit path,
  drop-preview path, and the WorktreeList project-count lookup) so the
  bucket-key format lives in exactly one place.
- Make getVirtualRowStart module-private (no external consumer).
The sidebar drag is the first caller to pass a numeric project order through
moveProjectToGroup and a tabOrder through updateProjectGroup (the context menu
never did). Both route through callRuntimeRpc for runtime-owned projects, so
pin that envelope with mocked-transport tests:
- moveProjectToGroup forwards a numeric order over projectGroup.moveProject
  (prior coverage only exercised order: undefined).
- updateProjectGroup forwards { tabOrder } over projectGroup.update (no prior
  RPC coverage for this method).

This is the mock-based equivalent of the remote-host manual test; SSH-owned
repos route project-group ops locally, so only runtime environments hit RPC.
Both live in the project-groups suite to stay under the file's max-lines cap.
The 'All' suffix read as 'all repos including hidden', but it only ever held
the sidebar-visible repo headers across all buckets (the source-bucket flat
array is the separate sidebarRepoHeaderIds). Drop the suffix to match the
source prop name and document that it excludes filtered/collapsed members, so
the visible-only basis of cross-bucket sibling ordering is explicit at the
type.
measureProjectHeaderDragRects measured project headers as header-height rects,
so 'append after the last project' put the drop line at the header bottom —
inside the worktrees of a project that has them. Extend each project rect's
bottom to the next header's top (project or group), or the last rendered row,
so a project's drop footprint is its whole block (header + worktrees), matching
how measureGroupHeaderDragRects already handles group blocks. The line now
lands below a project's worktrees instead of between them.
Extending project rects to block extents (prev commit) also moved the
before/after midpoint into the worktrees, so hovering the upper part of a
project-with-worktrees resolved to 'before it' — and when the dragged project
sat immediately above, that hit the below-itself no-op collapse and snapped
home, making it feel impossible to drop below such a project.

Keep block extents for the drop-line position, but threshold before/after on
the header row's midpoint (new headerBottom field) so hovering a project's
body reads as 'after it'. The before zone is now the header's top sliver.
The drop indicator added a cosmetic INDICATOR_GAP_PX to its Y, but the
gap-opening shift keys off that same Y. So dropping a project at the bottom of
a group put dropY a few px past the next group's header top, pulling that
unrelated group's unit into the upward shift (it visibly moved up with the
drop). Drop the cosmetic offset so the indicator equals the insertion boundary
and the shift only moves units genuinely above it. Applied to both project and
group drop computation; removed the now-unused constant.
The drop preview measured project block boundaries via resolveVirtualRowTop
(the header element's top, which includes the inter-group pt-1 spacer), while
the gap-opening shift keys off the virtualizer's row start. For a group header
below a project the two differed by the 4px spacer, so the drop boundary sat
just past the next group's start and the shift pulled that unrelated group up
with the drag. Measure project drag boundaries from the virtual row's slot
start (new resolveVirtualRowStart) so they match the shift exactly; a unit at
the boundary now correctly stays put.
Symmetry with the project-drag fix: measureGroupHeaderDragRects measured
boundaries via resolveVirtualRowTop while group drag feeds its indicator into
the same gap-opening shift (keyed off the virtualizer's row start). A group
header's inter-group pt-1 spacer offset the boundary from the shift's
coordinate by the same few px, latently able to over/under-shift a sibling at
block edges. Measure from the virtual row's slot start here too. Also rename a
test whose name overclaimed (it exercises the block-midpoint fallback, not the
header-row threshold).
On drop the drag visual clears synchronously, but moveProjectToGroup only
updated the store after its IPC/RPC round-trip — so the project briefly
re-rendered in its old slot before snapping to the new one. Mirror
reorderRepos: apply the new projectGroupId/order to the store synchronously so
it batches with the drag-clear into a single render, then reconcile with main's
authoritative repo (or revert that repo on failure). Also fixes the same flash
for the context-menu Move to group.
Same fix as moveProjectToGroup, for group drag: updateProjectGroup committed
the new tabOrder only after its IPC/RPC round-trip, so a dropped group briefly
re-rendered in its old slot before re-sorting. Apply the updates to the store
synchronously so they batch with the drag-clear into one render, reconcile with
main's authoritative group, and revert on failure. Also removes the flash for
group rename.
@NicholasZolton

NicholasZolton commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor Author

I know this PR is a bit large, but I took the liberty of trying to unify some of the drag logic and make sure it's well tested, feel free to let me know if you have any thoughts/notes/changes you'd like made! For what it's worth, the changes should be pretty isolated from any other logic too, so low blast radius overall.

@ghost

ghost commented Jun 30, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 7 individual chapters for you:

Title
1 Extract shared sidebar drag utilities
2 Implement generic pointer drag hook
3 Add row segmentation for block drags
4 Enhance project header drag logic
5 Implement group header drag
6 Add optimistic updates to store
7 Integrate draggable headers into Sidebar
Open in Stage

Chapters generated by Stage for commit 4edc0be on Jun 30, 2026 3:49pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds pointer-based drag reordering for repo/project headers and project-group headers in the sidebar. It introduces shared drag predicates, virtual-row geometry helpers, a generic useSidebarHeaderPointerDrag hook, project-header cross-bucket drop handling, group-header drag modules, sidebar wiring for both drag paths, and optimistic store updates for project moves and group updates.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is clearly about draggable projects and groups in the sidebar, which matches the main change despite awkward wording.
Linked Issues check ✅ Passed The PR implements the requested sidebar header dragging, including reordering groups, reordering projects, and moving projects between groups.
Out of Scope Changes check ✅ Passed The changes are focused on sidebar drag/drop, persistence, and tests, with no obvious unrelated functionality introduced.
Description check ✅ Passed The PR description follows the required template and includes all requested sections, including testing, AI review, security, and notes.

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.

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

Actionable comments posted: 8

🧹 Nitpick comments (2)
src/renderer/src/components/sidebar/project-header-drop.test.ts (1)

119-225: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a virtualized-index regression case.

These cases only use contiguous headerIndex values. Add one where the mounted rects start at a higher index, e.g. headerIndex: 50, and assert dropping after it returns 51, not targetRects.length.

src/renderer/src/components/sidebar/project-header-drag-commit.test.ts (1)

102-128: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact computed order.

expect.any(Number) proves an order was produced, but not that the destination insertion index was honored. These fixtures deterministically produce 1, so assert that value.

🧪 Proposed test tightening
-    expect(onCommitProjectGroupOrder).toHaveBeenCalledWith('c', 'group-2', expect.any(Number))
+    expect(onCommitProjectGroupOrder).toHaveBeenCalledWith('c', 'group-2', 1)
@@
-    expect(onCommitProjectGroupOrder).toHaveBeenCalledWith('a', null, expect.any(Number))
+    expect(onCommitProjectGroupOrder).toHaveBeenCalledWith('a', null, 1)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d678f37d-2805-4188-894e-c440adec4ee9

📥 Commits

Reviewing files that changed from the base of the PR and between 25a7a6f and 99173a9.

📒 Files selected for processing (35)
  • src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx
  • src/renderer/src/components/sidebar/WorktreeList.tsx
  • src/renderer/src/components/sidebar/group-header-drag-commit.test.ts
  • src/renderer/src/components/sidebar/group-header-drag-commit.ts
  • src/renderer/src/components/sidebar/group-header-drag-contract.test.ts
  • src/renderer/src/components/sidebar/group-header-drag-contract.ts
  • src/renderer/src/components/sidebar/group-header-drag-start.test.ts
  • src/renderer/src/components/sidebar/group-header-drag-start.ts
  • src/renderer/src/components/sidebar/group-header-drag.test.ts
  • src/renderer/src/components/sidebar/group-header-drag.ts
  • src/renderer/src/components/sidebar/group-header-drop.test.ts
  • src/renderer/src/components/sidebar/group-header-drop.ts
  • src/renderer/src/components/sidebar/header-drag-block-units.test.ts
  • src/renderer/src/components/sidebar/header-drag-block-units.ts
  • src/renderer/src/components/sidebar/header-drag-preview-rows.test.ts
  • src/renderer/src/components/sidebar/header-drag-preview-rows.ts
  • src/renderer/src/components/sidebar/header-drag-row-shifts.test.ts
  • src/renderer/src/components/sidebar/header-drag-row-shifts.ts
  • src/renderer/src/components/sidebar/header-drag-target-predicates.ts
  • src/renderer/src/components/sidebar/project-header-drag-commit.test.ts
  • src/renderer/src/components/sidebar/project-header-drag-commit.ts
  • src/renderer/src/components/sidebar/project-header-drag-contract.ts
  • src/renderer/src/components/sidebar/project-header-drag-start.test.ts
  • src/renderer/src/components/sidebar/project-header-drag-start.ts
  • src/renderer/src/components/sidebar/project-header-drag.test.ts
  • src/renderer/src/components/sidebar/project-header-drag.ts
  • src/renderer/src/components/sidebar/project-header-drop.test.ts
  • src/renderer/src/components/sidebar/project-header-drop.ts
  • src/renderer/src/components/sidebar/sidebar-drop-order-interpolation.test.ts
  • src/renderer/src/components/sidebar/sidebar-drop-order-interpolation.ts
  • src/renderer/src/components/sidebar/sidebar-header-pointer-drag.ts
  • src/renderer/src/components/sidebar/sidebar-virtual-row-offset.ts
  • src/renderer/src/components/sidebar/worktree-sidebar-pointer-drag-dom.ts
  • src/renderer/src/store/slices/repos-project-groups.test.ts
  • src/renderer/src/store/slices/repos.ts

Comment thread src/renderer/src/store/slices/repos.ts Resolved
CodeRabbit review on stablyai#6911:
- header-drag-target-predicates: guard with instanceof Element, not HTMLElement,
  so clicks on SVG icons inside handles/actions still match (closest()).
- sidebar-header-pointer-drag: track latestPointerX and feed it to the autoscroll
  bounds check; clientX:0 made autoscroll a no-op when the sidebar's left edge >0.
- project-header-drop: let a cross-bucket drag target an expanded group via its
  header; derive the append index from the last sibling's full headerIndex, not
  the mounted-rect count (virtualization undercounts).
- header-drag-block-units: scope group units to the dragged group's parent, not
  depth alone, so same-depth branches under other parents don't shift.
- sidebar-virtual-row-offset: treat an empty row-start attribute as invalid
  (Number('') is 0).
- Tests: add a virtualized-index append case; assert exact interpolated order.
@NicholasZolton

Copy link
Copy Markdown
Contributor Author

looks like there's been a bunch of work on the drag since I last peeked at this PR
curious on your thoughts @Jinwoo-H
I think there's a number of bugs that I fixed in this PR but are still present in the current versions
I'm happy to tidy this up and just port the current drag functionality over to my changes instead
or we can close this one - happy either way! (one notably feature missing from current functionality is changing which projects groups are assigned to via dragging)

Current dragging in my testing:
CleanShot 2026-07-07 at 10 33 10

This PR:
CleanShot 2026-06-30 at 09 22 49

@palbrecht1

Copy link
Copy Markdown
Contributor

Looks like a regression :(

@AmethystLiang

Copy link
Copy Markdown
Contributor

Thank you @NicholasZolton for the project and group drag work! We credited this PR in #39768, which addresses interleaving ungrouped projects and groups at the sidebar root. This PR also covers moving projects into or between groups, so I’m leaving it open.

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Draggable projects and groups in the sidebar

6 participants