feat(sidebar): search the workspace switcher when a user has many workspaces#5894
feat(sidebar): search the workspace switcher when a user has many workspaces#5894waleedlatif1 wants to merge 1 commit into
Conversation
…kspaces Shows a search input in the workspace dropdown once the list exceeds WORKSPACE_SEARCH_THRESHOLD (3). ArrowUp/Down move through results, Enter switches, and the query resets on close. Filtering is memoized and the highlight/reset/scroll machinery is gated on showSearch so users with few workspaces get no extra re-renders. Uses the canonical ChipInput for the field chrome.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview A Reviewed by Cursor Bugbot for commit 847ff5a. Configure here. |
Greptile SummaryAdds searchable, keyboard-navigable workspace selection for users with more than three workspaces.
Confidence Score: 3/5The keyboard-close and stale-selection regressions should be fixed before merging. The search handler consumes Escape without closing the dropdown, and an asynchronous workspace-list update can leave the highlighted index outside the filtered results so Enter performs no selection. apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx Important Files Changed
Reviews (1): Last reviewed commit: "feat(sidebar): search the workspace swit..." | Re-trigger Greptile |
| setHighlightedIndex(0) | ||
| }} | ||
| onKeyDown={(e) => { | ||
| e.stopPropagation() |
| } else if (e.key === 'Enter') { | ||
| e.preventDefault() | ||
| const target = filteredWorkspaces[highlightedIndex] | ||
| if (target) onWorkspaceSwitch(target) |
There was a problem hiding this comment.
Stale highlight disables selection
When the workspace query updates while this menu is open and the filtered list shrinks below the current highlighted index, the index is not clamped. Enter then reads an out-of-range element and does nothing, leaving keyboard users unable to select the displayed result until they move the highlight or reopen the menu.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 847ff5a. Configure here.
| if (!open && showSearch) { | ||
| setWorkspaceSearch('') | ||
| setHighlightedIndex(0) | ||
| } |
There was a problem hiding this comment.
Stale search after menu close
Medium Severity
Search query and highlight reset only run inside onOpenChange, but the menu is often closed by calling setIsWorkspaceMenuOpen(false) directly (new workspace, invite, manage, delete, leave, context-menu dismiss). Those paths skip the reset, so a prior query can still filter the list on the next open.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 847ff5a. Configure here.


Summary
WORKSPACE_SEARCH_THRESHOLD)showSearchso users with few workspaces get zero extra re-rendersChipInputfor the field chrome (leading Search icon, ref-forwarded focus) — no hand-rolled chip stylingimprovement/uiincl. the effect-guard/perf fixes so it doesn't flash on openType of Change
Testing
Tested manually
Checklist