From a8a0e74ce108fdf1d29d06c2e8fb71d78263d479 Mon Sep 17 00:00:00 2001 From: Daniel Isaac Geslin Date: Thu, 22 Aug 2024 15:01:34 +0200 Subject: [PATCH] [bug] Local env fix on chains order (#1040) --- apps/connect/package.json | 4 ++-- apps/connect/src/hooks/useConnectConfig.ts | 2 +- apps/connect/src/utils/getSortedChains.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/connect/package.json b/apps/connect/package.json index 024f8c784..8224f6bff 100644 --- a/apps/connect/package.json +++ b/apps/connect/package.json @@ -7,11 +7,11 @@ "dev:usdc-bridge": "vite --config ./vite.usdc-bridge.config.ts", "dev:usdc-bridge:mainnet": "cross-env VITE_APP_CLUSTER=mainnet npm run dev:usdc-bridge", "dev:usdc-bridge:testnet": "cross-env VITE_APP_CLUSTER=testnet npm run dev:usdc-bridge", - "build:usdc-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && vite build --config ./vite.usdc-bridge.config.ts", + "build:usdc-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && cross-env VITE_APP_CLUSTER=mainnet vite build --config ./vite.usdc-bridge.config.ts", "dev:token-bridge": "vite --config ./vite.token-bridge.config.ts", "dev:token-bridge:mainnet": "cross-env VITE_APP_CLUSTER=mainnet npm run dev:token-bridge", "dev:token-bridge:testnet": "cross-env VITE_APP_CLUSTER=testnet npm run dev:token-bridge", - "build:token-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && vite build --config ./vite.token-bridge.config.ts", + "build:token-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && cross-env VITE_APP_CLUSTER=mainnet vite build --config ./vite.token-bridge.config.ts", "dev": "npm run dev:token-bridge:testnet", "start": "npm run dev", "build": "tsc && vite build", diff --git a/apps/connect/src/hooks/useConnectConfig.ts b/apps/connect/src/hooks/useConnectConfig.ts index b0871ece7..d4629fc0d 100644 --- a/apps/connect/src/hooks/useConnectConfig.ts +++ b/apps/connect/src/hooks/useConnectConfig.ts @@ -73,7 +73,7 @@ export const useConnectConfig = () => { getSortedChains( ENV.wormholeConnectConfig.networks as ChainName[], controller.signal - ).then((chains) => setNetworks(chains)); + ).then((chains) => !!chains && setNetworks(chains)); return () => controller.abort(); }, []); diff --git a/apps/connect/src/utils/getSortedChains.ts b/apps/connect/src/utils/getSortedChains.ts index 8e9e6848d..8e731d6fa 100644 --- a/apps/connect/src/utils/getSortedChains.ts +++ b/apps/connect/src/utils/getSortedChains.ts @@ -12,7 +12,7 @@ interface TopSymbolsByVolume { export const getSortedChains = async ( chains: ChainName[], signal?: AbortSignal -): Promise => { +): Promise => { try { const response: TopSymbolsByVolume = await fetch( "https://api.wormholescan.io/api/v1/top-symbols-by-volume?timeSpan=30d", @@ -36,7 +36,7 @@ export const getSortedChains = async ( volumePerChain[CHAINS[chainName]] || 0; return [...chains].sort((a, b) => getChainScore(b) - getChainScore(a)); - } catch { - return chains; + } catch (error) { + if ((error as Error).name !== "AbortError") return chains; } };