From 5439b3991b6f61fd547ae8ef1d2020e04f6ec1a3 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Tue, 7 Apr 2026 18:25:06 +0200 Subject: [PATCH] fix: auto-dismiss overlay when no suggestions are available --- surfsense_web/app/desktop/suggestion/page.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/surfsense_web/app/desktop/suggestion/page.tsx b/surfsense_web/app/desktop/suggestion/page.tsx index af1c50be0..e458f6615 100644 --- a/surfsense_web/app/desktop/suggestion/page.tsx +++ b/surfsense_web/app/desktop/suggestion/page.tsx @@ -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();