Skip to content

Commit

Permalink
add polling for samples result
Browse files Browse the repository at this point in the history
  • Loading branch information
dauglyon committed Apr 15, 2024
1 parent 7a6f89c commit 4e5800a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/features/collections/data_products/SampleAttribs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export const SampleAttribs: FC<{
[attribParams]
);
// Current Data
const { data, isFetching } = getSampleAttribs.useQuery(attribParams);
const result = getSampleAttribs.useQuery(attribParams);
const { data, isFetching } = result;
const { data: countData } = getSampleAttribs.useQuery(countParams);
const allCountParams = useMemo(
() => ({
Expand Down Expand Up @@ -127,6 +128,18 @@ export const SampleAttribs: FC<{
selectData.data?.selection_state === 'processing'
);

// Polling needed for main result, as it is not a primary dataproduct like genomes
const pollFor: ('match_state' | 'selection_state')[] = [
'match_state',
'selection_state',
];
if (!attribParams.match_id) pollFor.splice(pollFor.indexOf('match_state'), 1);
if (!attribParams.selection_id)
pollFor.splice(pollFor.indexOf('selection_state'), 1);
useProcessStatePolling(result, pollFor, {
skipPoll: !(attribParams.match_id || attribParams.selection_id),
});
// Also poll for the selection state
useProcessStatePolling(selectData, ['selection_state']);

useFilterContexts(collection_id, [
Expand Down

0 comments on commit 4e5800a

Please sign in to comment.