fix: auto-dismiss overlay when no suggestions are available

This commit is contained in:
CREDO23 2026-04-07 18:25:06 +02:00
parent 70807cccd1
commit 5439b3991b

View file

@ -97,6 +97,14 @@ export default function SuggestionPage() {
return () => clearTimeout(timer);
}, [error, api]);
useEffect(() => {
if (isLoading || error || options.length > 0) return;
const timer = setTimeout(() => {
api?.dismissSuggestion?.();
}, AUTO_DISMISS_MS);
return () => clearTimeout(timer);
}, [isLoading, error, options, api]);
const fetchSuggestion = useCallback(
async (screenshot: string, searchSpaceId: string, appName?: string, windowTitle?: string) => {
abortRef.current?.abort();