From 3ec2d4605147362c774d44ed89cf4f6420e3cf0b Mon Sep 17 00:00:00 2001 From: "DESKTOP-RTLN3BA\\$punk" Date: Sun, 28 Dec 2025 16:02:56 -0800 Subject: [PATCH] feat: Invalidate logs summary and enable refetch on mount for fresh processing tasks display --- surfsense_web/atoms/documents/document-mutation.atoms.ts | 4 ++++ surfsense_web/hooks/use-logs.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/surfsense_web/atoms/documents/document-mutation.atoms.ts b/surfsense_web/atoms/documents/document-mutation.atoms.ts index 0eae1081d..09e127735 100644 --- a/surfsense_web/atoms/documents/document-mutation.atoms.ts +++ b/surfsense_web/atoms/documents/document-mutation.atoms.ts @@ -49,6 +49,10 @@ export const uploadDocumentMutationAtom = atomWithMutation((get) => { onSuccess: () => { toast.success("Files uploaded for processing"); + // Invalidate logs summary to show new processing tasks immediately on documents page + queryClient.invalidateQueries({ + queryKey: cacheKeys.logs.summary(searchSpaceId ?? undefined), + }); }, }; }); diff --git a/surfsense_web/hooks/use-logs.ts b/surfsense_web/hooks/use-logs.ts index bee9a1955..8432a5557 100644 --- a/surfsense_web/hooks/use-logs.ts +++ b/surfsense_web/hooks/use-logs.ts @@ -141,6 +141,8 @@ export function useLogsSummary( }), enabled: !!searchSpaceId, staleTime: 3 * 60 * 1000, + // Always refetch on mount to show fresh processing tasks when navigating to the page + refetchOnMount: "always", // Smart polling: only poll when there are active tasks and polling is enabled // This prevents unnecessary API calls when nothing is being processed refetchInterval: enablePolling