diff --git a/apps/connect-v1/src/hooks/useConnectConfig.ts b/apps/connect-v1/src/hooks/useConnectConfig.ts index a6ab7db6..186cd2cc 100644 --- a/apps/connect-v1/src/hooks/useConnectConfig.ts +++ b/apps/connect-v1/src/hooks/useConnectConfig.ts @@ -71,11 +71,15 @@ export const useConnectConfig = () => { useEffect(() => { const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), 1500); // Abort after 1.5 seconds getSortedChains( ENV.wormholeConnectConfig.networks as ChainName[], controller.signal ).then((chains) => !!chains && setNetworks(chains)); - return () => controller.abort(); + return () => { + clearTimeout(timeoutId); // Clear the timeout + controller.abort(); + } }, []); return networks ? config : undefined; diff --git a/apps/connect/src/hooks/useConnectConfig.ts b/apps/connect/src/hooks/useConnectConfig.ts index f104c012..13498f73 100644 --- a/apps/connect/src/hooks/useConnectConfig.ts +++ b/apps/connect/src/hooks/useConnectConfig.ts @@ -95,11 +95,15 @@ export const useConnectConfig = () => { useEffect(() => { const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), 1500); // Abort after 1.5 seconds getSortedChains( ENV.wormholeConnectConfig.chains as Chain[], controller.signal ).then((chains) => !!chains && setNetworks(chains)); - return () => controller.abort(); + return () => { + clearTimeout(timeoutId); // Clear the timeout + controller.abort(); + } }, []); return networks ? config : undefined;