fix for b/414940078 (#306)

This commit is contained in:
Allen Hutchison 2025-05-09 15:38:19 -07:00 committed by GitHub
parent e9274b2ab2
commit 4a6d0717a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ export function useCompletion(
setSuggestions(filteredSuggestions); setSuggestions(filteredSuggestions);
setShowSuggestions(filteredSuggestions.length > 0); setShowSuggestions(filteredSuggestions.length > 0);
setActiveSuggestionIndex(-1); setActiveSuggestionIndex(filteredSuggestions.length > 0 ? 0 : -1);
setVisibleStartIndex(0); setVisibleStartIndex(0);
setIsLoadingSuggestions(false); setIsLoadingSuggestions(false);
return; return;
@ -189,7 +189,7 @@ export function useCompletion(
if (isMounted) { if (isMounted) {
setSuggestions(filteredSuggestions); setSuggestions(filteredSuggestions);
setShowSuggestions(filteredSuggestions.length > 0); setShowSuggestions(filteredSuggestions.length > 0);
setActiveSuggestionIndex(-1); setActiveSuggestionIndex(filteredSuggestions.length > 0 ? 0 : -1);
setVisibleStartIndex(0); setVisibleStartIndex(0);
} }
} catch (error) { } catch (error) {