Skip to content

fix(desktop): enable workspace drag reordering in collapsed v2 sidebar - #5871

Merged
AviPeltz merged 3 commits into
mainfrom
fix-collapsed-sidebar-dra
Jul 22, 2026
Merged

AviPeltz merged 3 commits into
mainfrom
fix-collapsed-sidebar-dra

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

In the v2 sidebar, workspaces could only be drag-reordered when the sidebar was expanded — the collapsed rail rendered workspace icons as plain, non-draggable items (v1 supports dragging in both states).

  • Wire useSidebarDnd into DashboardSidebarCollapsedProjectContent so collapsed workspace icons are sortable via the same DndContext/SortableContext setup as the expanded list
  • Add a SortableCollapsedWorkspaceItem wrapper (mirrors SortableWorkspaceItem) applying the sortable transform/listeners around the collapsed icon
  • Reorders persist through the same commit path as expanded mode, including implicit cross-section moves; the pinned local workspace stays non-draggable, matching expanded behavior

Test Plan

  • Collapse the v2 sidebar, drag a workspace icon to a new position — order updates and persists
  • Expand the sidebar — new order is reflected (including section membership if dragged past a section boundary)
  • Click, right-click context menu, and hover card on collapsed icons still work (drag only activates after 8px movement)
  • bun run typecheck and bun run lint pass

https://claude.ai/code/session_01YRQUW3p84JVMXjjHp2sBs2


Summary by cubic

Enables drag-and-drop reordering of workspaces in the collapsed v2 sidebar, matching the expanded sidebar and v1 behavior. Order changes persist (including cross-section moves) and remain stable across collapse/expand.

  • Bug Fixes
    • Wired useSidebarDnd into collapsed project content via DndContext and SortableContext from @dnd-kit/core/@dnd-kit/sortable.
    • Added SortableCollapsedWorkspaceItem so only workspace icons in the rail are draggable; pinned local main workspace remains non-draggable.
    • Normalizes drop results to keep pinned local main workspaces first, preventing silent reorders on remount.

Written for commit 6854a2f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added drag-and-drop support to reorder workspaces in the collapsed project sidebar.
    • Workspace tiles now show clear drag-and-drop visual feedback during sorting.
    • Maintains existing workspace hover behavior and shortcut labels in the collapsed sidebar.
  • Improvements
    • Improved drag behavior to keep “pinned” local workspaces ordered at the top after rearranging.

The collapsed sidebar rendered workspace icons as plain items with no
drag wiring, while the expanded sidebar used useSidebarDnd. Wire the
same DnD hook into the collapsed project content so collapsed workspace
icons are sortable, matching v1 behavior. Cross-section moves persist
through the same commit path as expanded mode.

Claude-Session: https://claude.ai/code/session_01YRQUW3p84JVMXjjHp2sBs2
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The collapsed project rail now receives project children, derives workspace items through useSidebarDnd, and renders them in sortable drag-and-drop contexts. Reorder results normalize local-device main workspaces to the beginning before persistence.

Changes

Collapsed sidebar drag-and-drop

Layer / File(s) Summary
Project children contract
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarProjectSection/...
The project section passes project identity and project.children; collapsed content updates its props from a workspace list to project children.
Collapsed workspace rail
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarProjectSection/components/DashboardSidebarCollapsedProjectContent/...
The component filters DnD flat items to workspaces and renders them through DndContext, SortableContext, and the sortable wrapper.
Sortable workspace wrapper
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarProjectSection/components/SortableCollapsedWorkspaceItem/*
SortableCollapsedWorkspaceItem connects collapsed workspace rendering to useSortable, drag listeners, attributes, and drag-time styling.
Pinned workspace ordering
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useSidebarDnd/useSidebarDnd.ts
Section and workspace reorder results are normalized so local-device main workspaces remain first before state updates and persistence.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProjectSection
  participant CollapsedProjectContent
  participant SidebarDnd
  participant SortableWorkspace
  ProjectSection->>CollapsedProjectContent: pass projectId and projectChildren
  CollapsedProjectContent->>SidebarDnd: derive flat workspace items
  CollapsedProjectContent->>SortableWorkspace: render workspace with sortableId
  SortableWorkspace->>SidebarDnd: submit sortable drag interactions
  SidebarDnd->>SidebarDnd: normalize pinned workspaces before persistence
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise, conventional, and accurately summarizes the main sidebar drag-reordering change.
Description check ✅ Passed The description covers what changed and how it was tested, though it does not follow the template headings exactly or include a completed checklist.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-collapsed-sidebar-dra

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.

AviPeltz added 2 commits July 22, 2026 02:26
The sidebar data builder always pins the local main workspace first,
but useSidebarDnd accepted drops that placed items above it. The
optimistic order looked fine while mounted (the rebuild produced the
same id sequence as before the drag, so the fingerprint sync never
fired), then silently reverted when the sidebar collapsed/expanded and
the component remounted. Normalize drop results so pinned local main
workspaces stay first — the optimistic order now matches what persists.

Claude-Session: https://claude.ai/code/session_01YRQUW3p84JVMXjjHp2sBs2
@AviPeltz
AviPeltz merged commit 7db5b86 into main Jul 22, 2026
11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

Laurence-NZ added a commit to Laurence-NZ/superset-pwsh that referenced this pull request Jul 23, 2026
…host CLI ParadevAI#5885, Cursor session labels ParadevAI#5882, open-in-IDE v2 ParadevAI#5877, collapsed sidebar DnD ParadevAI#5871, automations FK drop ParadevAI#5878)

# Conflicts:
#	apps/desktop/src/main/lib/agent-setup/notify-hook.test.ts
Laurence-NZ added a commit to Laurence-NZ/superset-pwsh that referenced this pull request Jul 23, 2026
…host CLI ParadevAI#5885, Cursor session labels ParadevAI#5882, open-in-IDE v2 ParadevAI#5877, collapsed sidebar DnD ParadevAI#5871, automations FK drop ParadevAI#5878)

# Conflicts:
#	apps/desktop/src/main/lib/agent-setup/notify-hook.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant