diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index 26c9b4d4dc..4f44be86ea 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -147,7 +147,10 @@ export const ApplicationsTable: React.FC = () => { const getTask = (application: Application) => tasks.find((task: Task) => task.application?.id === application.id); - const { tasks } = useFetchTasks({ addon: "analyzer" }, isAnalyzeModalOpen); + const { tasks, hasActiveTasks } = useFetchTasks( + { addon: "analyzer" }, + isAnalyzeModalOpen + ); const isTaskCancellable = (application: Application) => { const task = getTask(application); @@ -209,7 +212,7 @@ export const ApplicationsTable: React.FC = () => { isFetching: isFetchingApplications, error: applicationsFetchError, refetch: fetchApplications, - } = useFetchApplications(); + } = useFetchApplications(!hasActiveTasks); const { assessments, isFetching: isFetchingAssesments } = useFetchAssessments(); diff --git a/client/src/app/queries/tasks.ts b/client/src/app/queries/tasks.ts index 23d107a911..c2532f1ace 100644 --- a/client/src/app/queries/tasks.ts +++ b/client/src/app/queries/tasks.ts @@ -42,12 +42,14 @@ export const useFetchTasks = ( }, onError: (err) => console.log(err), }); + const hasActiveTasks = data && data.length > 0; return { tasks: data || [], isFetching: isLoading, fetchError: error, refetch, + hasActiveTasks, }; };