Skip to content

Commit a024e87

Browse files
authored
🐛 always refresh the application query on application inventory (#2346)
Resolves: https://issues.redhat.com/browse/MTA-5181 Historically and for performance reasons, the application inventory page tried to not always refresh in the background. The approach never really consistently worked, and if hub has a large number of applications, the refresh query logic would almost always run anyway. The refresh logic has been removed and the page will refresh the applications every 5 seconds. Performance issues may emerge in a large environment and #2350 was written to capture what is known and have some ideas about how to approach a solution. --------- Signed-off-by: Scott J Dickerson <[email protected]>
1 parent 463157b commit a024e87

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

client/src/app/pages/applications/applications-table/applications-table.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { useState } from "react";
33
import { AxiosError } from "axios";
44
import { useHistory } from "react-router-dom";
55
import { Trans, useTranslation } from "react-i18next";
6-
import dayjs from "dayjs";
76

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

186-
const [endOfAppImportPeriod, setEndOfAppImportPeriod] = useState<dayjs.Dayjs>(
187-
dayjs()
188-
);
189-
190185
const onChange = (
191186
_event: React.FormEvent<HTMLSelectElement>,
192187
value: string
@@ -216,7 +211,7 @@ export const ApplicationsTable: React.FC = () => {
216211
// ----- Table data fetches and mutations
217212
const { tagItems } = useFetchTagsWithTagItems();
218213

219-
const { tasks, hasActiveTasks } = useFetchTaskDashboard(isAnalyzeModalOpen);
214+
const { tasks } = useFetchTaskDashboard(isAnalyzeModalOpen);
220215

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

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

323316
const {
324317
applications,
@@ -1264,7 +1257,6 @@ export const ApplicationsTable: React.FC = () => {
12641257
<ImportApplicationsForm
12651258
onSaved={() => {
12661259
setIsApplicationImportModalOpen(false);
1267-
setEndOfAppImportPeriod(dayjs().add(15, "s"));
12681260
}}
12691261
/>
12701262
</Modal>

client/src/app/queries/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const useFetchTaskDashboard = (refetchDisabled: boolean = false) => {
7979
});
8080

8181
const hasActiveTasks =
82-
data && data.some((task) => TaskStates.Queued.includes(task.state ?? ""));
82+
data?.some((task) => TaskStates.Queued.includes(task.state ?? "")) ?? false;
8383

8484
return {
8585
tasks: data || [],

0 commit comments

Comments
 (0)