Problem
ChatInput/index.tsx constructs the exact same tabs array twice in handleKeyDown — once for ArrowRight/Tab and once for ArrowLeft:
Location
File: packages/desktop/src/renderer/components/ChatInput/index.tsx:240-257
// Line 240-245 (Tab/ArrowRight handler)
const tabs: MentionTab[] = [
...(mentionAgents.length > 0 ? (['agents'] as const) : []),
...(contextFolders.length > 0 ? (['local'] as const) : []),
'tasks', 'files',
];
setMentionTab((cur) => tabs[(tabs.indexOf(cur) + 1) % tabs.length]);
// Line 252-257 (ArrowLeft handler) — IDENTICAL array
const tabs: MentionTab[] = [
...(mentionAgents.length > 0 ? (['agents'] as const) : []),
...(contextFolders.length > 0 ? (['local'] as const) : []),
'tasks', 'files',
];
setMentionTab((cur) => tabs[(tabs.indexOf(cur) - 1 + tabs.length) % tabs.length]);
Fix Approach
Extract to a useMemo constant outside handleKeyDown:
const mentionTabs = useMemo<MentionTab[]>(() => [
...(mentionAgents.length > 0 ? (['agents'] as const) : []),
...(contextFolders.length > 0 ? (['local'] as const) : []),
'tasks', 'files',
], [mentionAgents.length, contextFolders.length]);
Then reference mentionTabs in both handlers.
Verification
- Run
pnpm check — must pass
- Open mention picker, Tab/ArrowRight/ArrowLeft between tabs — should cycle correctly
Context
- WG: UI & Design System
- Priority: Low (good first issue)
- Estimated effort: ~10 minutes
Problem
ChatInput/index.tsxconstructs the exact sametabsarray twice inhandleKeyDown— once for ArrowRight/Tab and once for ArrowLeft:Location
File:
packages/desktop/src/renderer/components/ChatInput/index.tsx:240-257Fix Approach
Extract to a
useMemoconstant outsidehandleKeyDown:Then reference
mentionTabsin both handlers.Verification
pnpm check— must passContext