Skip to content

Commit

Permalink
[bug] Local env fix on chains order (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielisaacgeslin authored Aug 22, 2024
1 parent d5129eb commit a8a0e74
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/hooks/useConnectConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}, []);

Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/utils/getSortedChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface TopSymbolsByVolume {
export const getSortedChains = async (
chains: ChainName[],
signal?: AbortSignal
): Promise<ChainName[]> => {
): Promise<ChainName[] | undefined> => {
try {
const response: TopSymbolsByVolume = await fetch(
"https://api.wormholescan.io/api/v1/top-symbols-by-volume?timeSpan=30d",
Expand All @@ -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;
}
};

0 comments on commit a8a0e74

Please sign in to comment.