From bfbae2f513823561045ce940dd411bf302150411 Mon Sep 17 00:00:00 2001 From: Ben Elferink Date: Mon, 25 Nov 2024 13:49:50 +0200 Subject: [PATCH] [GEN-1788] start polling CP on 1st mount (#1845) --- .../webapp/hooks/compute-platform/useComputePlatform.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts index 4d9b48664..b8445d4f9 100644 --- a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts +++ b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts @@ -1,4 +1,4 @@ -import { useCallback, useMemo } from 'react'; +import { useCallback, useEffect, useMemo } from 'react'; import { safeJsonParse } from '@/utils'; import { useQuery } from '@apollo/client'; import { useBooleanStore } from '@/store'; @@ -24,7 +24,7 @@ export const useComputePlatform = (): UseComputePlatformHook => { let retries = 0; const maxRetries = 5; - const retryInterval = 1 * 1000; // time in milliseconds + const retryInterval = 2 * 1000; // time in milliseconds while (retries < maxRetries) { await new Promise((resolve) => setTimeout(resolve, retryInterval)); @@ -35,6 +35,11 @@ export const useComputePlatform = (): UseComputePlatformHook => { togglePolling(false); }, [refetch, togglePolling]); + // this is to start polling on component mount in an attempt to fix any initial errors with sources/destinations + useEffect(() => { + startPolling(); + }, []); + const filteredData = useMemo(() => { if (!data) return undefined;