fix(desktop): enable workspace drag reordering in collapsed v2 sidebar
Merged
AV
4mo ago+153+153+012345678901234567890123456789-20-20-01234567890123456789
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
useSidebarDndintoDashboardSidebarCollapsedProjectContentso collapsed workspace icons are sortable via the sameDndContext/SortableContextsetup as the expanded list - Add a
SortableCollapsedWorkspaceItemwrapper (mirrorsSortableWorkspaceItem) 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 typecheckandbun run lintpass
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
useSidebarDndinto collapsed project content viaDndContextandSortableContextfrom@dnd-kit/core/@dnd-kit/sortable. - Added
SortableCollapsedWorkspaceItemso 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.
- Wired
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.