fix(chat): ensure onSelect is called only for valid command indices

This commit is contained in:
Haileyesus
2026-02-24 13:45:24 +03:00
parent fa8eeabc30
commit a04eec409c

View File

@@ -194,7 +194,7 @@ export default function CommandMenu({
isSelected ? 'bg-blue-50 dark:bg-blue-900' : 'bg-transparent'
}`}
onMouseEnter={() => onSelect && commandIndex >= 0 && onSelect(command, commandIndex, true)}
onClick={() => onSelect && onSelect(command, commandIndex, false)}
onClick={() => onSelect && commandIndex >= 0 && onSelect(command, commandIndex, false)}
onMouseDown={(event) => event.preventDefault()}
>
<div className="min-w-0 flex-1">