diff --git a/surfsense_backend/app/tasks/celery_tasks/document_tasks.py b/surfsense_backend/app/tasks/celery_tasks/document_tasks.py index cf5a06789..669ea389f 100644 --- a/surfsense_backend/app/tasks/celery_tasks/document_tasks.py +++ b/surfsense_backend/app/tasks/celery_tasks/document_tasks.py @@ -130,12 +130,11 @@ async def _process_extension_document( ) # Update notification on success - chunks_count = len(result.chunks) if hasattr(result, 'chunks') and result.chunks else None await NotificationService.document_processing.notify_processing_completed( session=session, notification=notification, document_id=result.id, - chunks_count=chunks_count, + chunks_count=None, ) else: await task_logger.log_task_success( @@ -236,12 +235,11 @@ async def _process_youtube_video(url: str, search_space_id: int, user_id: str): ) # Update notification on success - chunks_count = len(result.chunks) if hasattr(result, 'chunks') and result.chunks else None await NotificationService.document_processing.notify_processing_completed( session=session, notification=notification, document_id=result.id, - chunks_count=chunks_count, + chunks_count=None, ) else: await task_logger.log_task_success( @@ -354,12 +352,11 @@ async def _process_file_upload( # Update notification on success if result: - chunks_count = len(result.chunks) if hasattr(result, 'chunks') and result.chunks else None await NotificationService.document_processing.notify_processing_completed( session=session, notification=notification, document_id=result.id, - chunks_count=chunks_count, + chunks_count=None, ) else: # Duplicate detected @@ -508,12 +505,11 @@ async def _process_circleback_meeting( # Update notification on success if notification: - chunks_count = len(result.chunks) if hasattr(result, 'chunks') and result.chunks else None await NotificationService.document_processing.notify_processing_completed( session=session, notification=notification, document_id=result.id, - chunks_count=chunks_count, + chunks_count=None, ) else: await task_logger.log_task_success( diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/ProcessingIndicator.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/ProcessingIndicator.tsx deleted file mode 100644 index 4ee966e1e..000000000 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/ProcessingIndicator.tsx +++ /dev/null @@ -1,44 +0,0 @@ -"use client"; - -import { Loader2 } from "lucide-react"; -import { AnimatePresence, motion } from "motion/react"; -import { useTranslations } from "next-intl"; -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; - -interface ProcessingIndicatorProps { - documentProcessorTasksCount: number; -} - -export function ProcessingIndicator({ documentProcessorTasksCount }: ProcessingIndicatorProps) { - const t = useTranslations("documents"); - - // Only show when there are document_processor tasks (uploads), not connector_indexing_task (periodic reindexing) - if (documentProcessorTasksCount === 0) return null; - - return ( - - - -
-
- -
-
- - {t("processing_documents")} - - - {t("active_tasks_count", { count: documentProcessorTasksCount })} - -
-
-
-
-
- ); -} diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx index 019f5796a..6a24e85ad 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/page.tsx @@ -6,19 +6,17 @@ import { RefreshCw } from "lucide-react"; import { motion } from "motion/react"; import { useParams } from "next/navigation"; import { useTranslations } from "next-intl"; -import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react"; +import { useCallback, useEffect, useId, useMemo, useState } from "react"; import { toast } from "sonner"; import { deleteDocumentMutationAtom } from "@/atoms/documents/document-mutation.atoms"; import { documentTypeCountsAtom } from "@/atoms/documents/document-query.atoms"; import { Button } from "@/components/ui/button"; import type { DocumentTypeEnum } from "@/contracts/types/document.types"; -import { useLogsSummary } from "@/hooks/use-logs"; import { documentsApiService } from "@/lib/apis/documents-api.service"; import { cacheKeys } from "@/lib/query-client/cache-keys"; import { DocumentsFilters } from "./components/DocumentsFilters"; import { DocumentsTableShell, type SortKey } from "./components/DocumentsTableShell"; import { PaginationControls } from "./components/PaginationControls"; -import { ProcessingIndicator } from "./components/ProcessingIndicator"; import type { ColumnVisibility } from "./components/types"; function useDebounced(value: T, delay = 250) { @@ -142,30 +140,6 @@ export default function DocumentsTable() { } }, [debouncedSearch, refetchSearch, refetchDocuments, t, isRefreshing]); - // Set up smart polling for active tasks - only polls when tasks are in progress - const { summary } = useLogsSummary(searchSpaceId, 24, { - enablePolling: true, - refetchInterval: 5000, // Poll every 5 seconds when tasks are active - }); - - // Filter active tasks to only include document_processor tasks (uploads via "add sources") - // Exclude connector_indexing_task tasks (periodic reindexing) - const documentProcessorTasks = - summary?.active_tasks.filter((task) => task.source === "document_processor") || []; - const documentProcessorTasksCount = documentProcessorTasks.length; - - const activeTasksCount = summary?.active_tasks.length || 0; - const prevActiveTasksCount = useRef(activeTasksCount); - - // Auto-refresh when a task finishes - useEffect(() => { - if (prevActiveTasksCount.current > activeTasksCount) { - // A task has finished! - refreshCurrentView(); - } - prevActiveTasksCount.current = activeTasksCount; - }, [activeTasksCount, refreshCurrentView]); - // Create a delete function for single document deletion const deleteDocument = useCallback( async (id: number) => { @@ -244,8 +218,6 @@ export default function DocumentsTable() { - -