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 59412be6df..bd45aa2f41 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -151,7 +151,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); @@ -213,7 +216,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, }; };