Fix autocomplete popover flicker

This commit is contained in:
Mohamed Boudra
2026-05-26 09:35:28 +07:00
parent 6e56ee9e32
commit 91b05b4111
4 changed files with 469 additions and 30 deletions
@@ -168,7 +168,7 @@ function resolveAutocompleteIsLoading(args: {
optionsLength: number;
}): boolean {
if (args.mode === "command") {
return args.isCommandsLoading;
return args.isCommandsLoading && args.optionsLength === 0;
}
if (args.mode === "file") {
return (
@@ -251,7 +251,7 @@ export function useAgentAutocomplete(input: UseAgentAutocompleteInput): AgentAut
const isConnected = useHostRuntimeIsConnected(serverId);
const mode = resolveAutocompleteMode({ showFileAutocomplete, showCommandAutocomplete });
const isVisible = resolveAutocompleteIsVisible({
const canShowAutocomplete = resolveAutocompleteIsVisible({
mode,
canLoadCommands,
serverId,
@@ -270,6 +270,8 @@ export function useAgentAutocomplete(input: UseAgentAutocompleteInput): AgentAut
draftConfig: queryDraftConfig,
});
const isVisible = canShowAutocomplete && !(mode === "command" && isCommandsLoading);
const fileSuggestionsQuery = useQuery({
queryKey: [
"directorySuggestions",