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