From 2f2e1f98001124af9ad5b8e585eb32a9eb67ff44 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Sat, 27 Dec 2025 19:48:45 +0530 Subject: [PATCH] feat: Add optional polling support to `useLogsSummary` hook via `refetchInterval` option. --- surfsense_web/hooks/use-logs.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/surfsense_web/hooks/use-logs.ts b/surfsense_web/hooks/use-logs.ts index 3a02ac055..b03d302bb 100644 --- a/surfsense_web/hooks/use-logs.ts +++ b/surfsense_web/hooks/use-logs.ts @@ -117,8 +117,12 @@ export function useLogs(searchSpaceId?: number, filters: LogFilters = {}) { }; } -// Separate hook for log summary -export function useLogsSummary(searchSpaceId: number, hours: number = 24) { +// Separate hook for log summary with optional polling support for document processing indicator UI +export function useLogsSummary( + searchSpaceId: number, + hours: number = 24, + options: { refetchInterval?: number } = {} +) { const { data: summary, isLoading: loading, @@ -133,6 +137,10 @@ export function useLogsSummary(searchSpaceId: number, hours: number = 24) { }), enabled: !!searchSpaceId, staleTime: 3 * 60 * 1000, + // Enable refetch interval for document processing indicator polling + refetchInterval: options.refetchInterval && options.refetchInterval > 0 + ? options.refetchInterval + : undefined, }); return { summary, loading, error, refreshSummary: refetch };