fix(desktop): align v2 sidebar shortcuts with rendered project order#4193
Conversation
Project shortcuts (⌘1–⌘9) were indexed off the live-query groups, so after a drag reorder they kept the original order until the persisted tabOrder write round-tripped — pressing ⌘1/⌘2/⌘3 jumped 1 → 3 → 2. Drive shortcuts off orderedGroups (the same locally-applied order the sidebar renders) so they track the visible layout immediately.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDashboardSidebar refactors initialization order so that ChangesSidebar Shortcut Label Ordering
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Greptile SummaryThis PR fixes a shortcut-order mismatch in the desktop sidebar: keyboard shortcuts (⌘1–⌘9, PREV/NEXT workspace) were derived from the raw server-backed
Confidence Score: 5/5Safe to merge — the change is a single two-line move of one hook call, and the hook it now receives ( The fix is minimal and correct: No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/DashboardSidebar.tsx | Moves useDashboardSidebarShortcuts call to receive orderedGroups (the locally-sorted list used by the DnD renderer) instead of the raw server-backed groups, so ⌘1–⌘9, PREV_WORKSPACE, and NEXT_WORKSPACE all track the visible order immediately after a drag. |
Sequence Diagram
sequenceDiagram
participant User
participant DashboardSidebar
participant DndContext
participant projectOrder_state as projectOrder (state)
participant orderedGroups_memo as orderedGroups (memo)
participant useDashboardSidebarShortcuts
User->>DndContext: drag project to new position
DndContext->>DashboardSidebar: onDragEnd(active, over)
DashboardSidebar->>projectOrder_state: setProjectOrder(arrayMove(...))
projectOrder_state-->>orderedGroups_memo: recompute (same render cycle)
orderedGroups_memo-->>useDashboardSidebarShortcuts: updated order passed in
useDashboardSidebarShortcuts-->>User: ⌘1–⌘9 / labels now reflect visible order immediately
Note over DashboardSidebar,useDashboardSidebarShortcuts: Before fix: shortcuts read raw groups (server order). After fix: shortcuts read orderedGroups (local drag order)
Reviews (1): Last reviewed commit: "fix(desktop): align v2 sidebar shortcuts..." | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
groups, so after a drag reorder they kept the original order until the persistedtabOrderwrite round-tripped — pressing ⌘1/⌘2/⌘3 jumped 1 → 3 → 2.useDashboardSidebarShortcutsofforderedGroups(the same locally-applied order the sidebar renders) so shortcuts track the visible layout immediately.Test plan
Summary by cubic
Fixes v2 sidebar shortcuts (⌘1–⌘9) to follow the visible project order immediately after drag reordering. Shortcuts and labels now match the rendered layout by using
orderedGroupsinstead of livegroups.useDashboardSidebarShortcutsfromorderedGroupsso shortcuts reflect the locally rendered order.Written for commit ed12852. Summary will update on new commits.
Summary by CodeRabbit