Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, { useState } from "react";
import { AxiosError } from "axios";
import { useHistory } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next";
import dayjs from "dayjs";

// @patternfly
import {
Expand Down Expand Up @@ -183,10 +182,6 @@ export const ApplicationsTable: React.FC = () => {
const [reviewToDiscard, setReviewToDiscard] =
useState<DecoratedApplication | null>(null);

const [endOfAppImportPeriod, setEndOfAppImportPeriod] = useState<dayjs.Dayjs>(
dayjs()
);

const onChange = (
_event: React.FormEvent<HTMLSelectElement>,
value: string
Expand Down Expand Up @@ -216,7 +211,7 @@ export const ApplicationsTable: React.FC = () => {
// ----- Table data fetches and mutations
const { tagItems } = useFetchTagsWithTagItems();

const { tasks, hasActiveTasks } = useFetchTaskDashboard(isAnalyzeModalOpen);
const { tasks } = useFetchTaskDashboard(isAnalyzeModalOpen);

const completedCancelTask = () => {
pushNotification({
Expand Down Expand Up @@ -311,14 +306,12 @@ export const ApplicationsTable: React.FC = () => {
return !!task && !TaskStates.Terminal.includes(task?.state ?? "");
};

// TODO: Review the refetchInterval calculation for the application list
// TODO: Perf concerns for this query: https://github.com/konveyor/tackle2-ui/issues/2350
const {
data: baseApplications,
isFetching: isFetchingApplications,
error: applicationsFetchError,
} = useFetchApplications(() =>
hasActiveTasks || dayjs().isBefore(endOfAppImportPeriod) ? 5000 : false
);
} = useFetchApplications();

const {
applications,
Expand Down Expand Up @@ -1264,7 +1257,6 @@ export const ApplicationsTable: React.FC = () => {
<ImportApplicationsForm
onSaved={() => {
setIsApplicationImportModalOpen(false);
setEndOfAppImportPeriod(dayjs().add(15, "s"));
}}
/>
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/queries/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const useFetchTaskDashboard = (refetchDisabled: boolean = false) => {
});

const hasActiveTasks =
data && data.some((task) => TaskStates.Queued.includes(task.state ?? ""));
data?.some((task) => TaskStates.Queued.includes(task.state ?? "")) ?? false;

return {
tasks: data || [],
Expand Down