fix: reset isLoading state in file autocomplete early-return paths (#631)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-21 21:07:00 -08:00
committed by GitHub
parent 30b265f5bd
commit 7f4fb6f14b

View File

@@ -81,6 +81,7 @@ export function FileAutocomplete({
if (!result) {
setMatches([]);
setIsLoading(false);
onActiveChange?.(false);
return;
}
@@ -96,6 +97,7 @@ export function FileAutocomplete({
// Always hide if there's more non-whitespace content after, or another @
if (afterSpace.trim().length > 0 || afterSpace.includes("@")) {
setMatches([]);
setIsLoading(false);
onActiveChange?.(false);
return;
}
@@ -107,12 +109,14 @@ export function FileAutocomplete({
if (matches[0]?.path !== query) {
setMatches([{ path: query, type: "file" }]);
}
setIsLoading(false);
onActiveChange?.(false); // Don't block Enter key
return;
}
// No valid selection was made, hide
setMatches([]);
setIsLoading(false);
onActiveChange?.(false);
return;
}
@@ -138,6 +142,7 @@ export function FileAutocomplete({
// Check if it's a URL pattern (no debounce)
if (query.startsWith("http://") || query.startsWith("https://")) {
setMatches([{ path: query, type: "url" }]);
setIsLoading(false);
onActiveChange?.(true);
return;
}