From cbc1f7b293140fecf1a305c32e3606a474a3a0ec Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:23:51 +0200 Subject: [PATCH] Use Promise.all --- components/chainSelect/ChainSelect.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/chainSelect/ChainSelect.tsx b/components/chainSelect/ChainSelect.tsx index 189f718..bfa7fbf 100644 --- a/components/chainSelect/ChainSelect.tsx +++ b/components/chainSelect/ChainSelect.tsx @@ -67,8 +67,10 @@ const ChainSelect = () => { const getGhJson = useCallback(async () => { // getting chain info from this repo: https://github.com/cosmos/chain-registry try { - const { data: chains } = await axios.get(chainsUrl); - const { data: testnets } = await axios.get(testnetsUrl); + const [{ data: chains }, { data: testnets }] = await Promise.all([ + axios.get(chainsUrl), + axios.get(testnetsUrl), + ]); const allChains: GithubChainRegistryItem[] = [...chains, ...testnets].filter( (item: GithubChainRegistryItem) => {