Skip to content

Commit

Permalink
Prevent aggregate runs multiple times
Browse files Browse the repository at this point in the history
Signed-off-by: popcorny <celu@infuseai.io>
  • Loading branch information
popcornylu committed Sep 25, 2024
1 parent 1708a27 commit a7e1509
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/src/lib/hooks/useRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ export const useRun = (runId?: string): UseRunResult => {

useEffect(() => {
if (error || run?.result || run?.error) {
setIsPolling(false);
if (run?.type === "row_count_diff") {
refetchRunsAggregated();
if (isPolling) {
setIsPolling(false);
if (run?.type === "row_count_diff") {
refetchRunsAggregated();
}
}
} else {
setIsPolling(true);
}
}, [run, error, refetchRunsAggregated]);
}, [run, error, isPolling, refetchRunsAggregated]);

const onCancel = useCallback(async () => {
setAborting(true);
Expand Down

0 comments on commit a7e1509

Please # to comment.