fetch relevant jobs based on WS events

This commit is contained in:
Keith J. Grant 2022-05-18 14:40:18 -07:00
parent 6a9305818e
commit 9972389a8d
2 changed files with 7 additions and 10 deletions

View File

@ -106,8 +106,12 @@ function JobList({
async (ids) => {
const params = parseQueryString(qsConfig, location.search);
params.id__in = ids.join(',');
const { data } = await UnifiedJobsAPI.read(params);
return data.results;
try {
const { data } = await UnifiedJobsAPI.read(params);
return data.results;
} catch (e) {
return [];
}
},
[location.search] // eslint-disable-line react-hooks/exhaustive-deps
);

View File

@ -47,16 +47,9 @@ export default function useWsJobs(initialJobs, fetchJobsById, qsConfig) {
return;
}
const params = parseQueryString(qsConfig, location.search);
const filtersApplied = Object.keys(params).length > 4;
if (
filtersApplied &&
!['completed', 'failed', 'error'].includes(lastMessage.status)
) {
return;
}
const jobId = lastMessage.unified_job_id;
const index = jobs.findIndex((j) => j.id === jobId);
if (index > -1) {
setJobs(sortJobs(updateJob(jobs, index, lastMessage), params));
} else {