fix(ui): prevent useSlashCompletion effects from running during @ completion (#8986)

This commit is contained in:
Sandy Tao
2025-09-20 09:13:58 -07:00
committed by GitHub
parent 468db8730a
commit 2216856e3c
2 changed files with 51 additions and 2 deletions
@@ -485,14 +485,20 @@ export function useSlashCompletion(props: UseSlashCompletionProps): {
);
const { isPerfectMatch } = usePerfectMatch(parserResult);
// Update external state - this is now much simpler and focused
// Clear internal state when disabled
useEffect(() => {
if (!enabled || query === null) {
if (!enabled) {
setSuggestions([]);
setIsLoadingSuggestions(false);
setIsPerfectMatch(false);
setCompletionStart(-1);
setCompletionEnd(-1);
}
}, [enabled, setSuggestions, setIsLoadingSuggestions, setIsPerfectMatch]);
// Update external state only when enabled
useEffect(() => {
if (!enabled || query === null) {
return;
}