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 4d5ef9d commit 6a753a3
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 6a753a3

Please sign in to comment.