Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Workspace navigation (Ctrl+J/K) now follows the visual order displayed in the sidebar.

Problem

PR #205 added recency-based sorting to the workspace display, but Ctrl+J/K navigation still used the unsorted config order. This caused confusion where pressing "next workspace" wouldn't select the next visible workspace in the sidebar.

Solution

Moved the sorting logic from ProjectSidebar to App.tsx so both navigation and display use the same recency-sorted workspace list. This ensures Ctrl+J/K navigation matches the visual order users see.

Changes

  • Added sortedWorkspacesByProject memo in App.tsx that sorts workspaces by recency
  • Updated handleNavigateWorkspace to use the sorted list instead of raw config order
  • Pass sorted list through LeftSidebar → ProjectSidebar props chain
  • Removed duplicate sorting logic from ProjectSidebar (now uses parent's sorted list)

Testing

  • ✅ All 379 unit tests pass
  • ✅ Type checking passes
  • Manual verification: Ctrl+J/K now navigates in the same order as displayed in sidebar

Generated with cmux

Navigation now follows visual order displayed in sidebar.

**Problem:**
- PR #205 added recency-based sorting to workspace display
- Ctrl+J/K navigation still used unsorted config order
- Caused confusion: pressing next didn't select next visible workspace

**Solution:**
- Move sorting logic from ProjectSidebar to App.tsx
- Share sorted list between navigation and display
- Both now use same recency-sorted order

**Changes:**
- Added sortedWorkspacesByProject memo in App.tsx
- Updated handleNavigateWorkspace to use sorted list
- Pass sorted list through LeftSidebar to ProjectSidebar
- Remove duplicate sorting logic from ProjectSidebar
Now that sorting is done in App.tsx, ProjectSidebar no longer needs
the workspaceRecency prop - it just receives the pre-sorted list.
@ammario ammario merged commit 04898dc into main Oct 13, 2025
7 checks passed
@ammario ammario deleted the fix-workspace-nav-with-sorting branch October 13, 2025 00:56
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.

2 participants