From 34ad23c3f3ebde475b4ad521cbbf9766a87a9289 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 25 Jul 2023 17:44:22 +0700 Subject: [PATCH] fix: can't fetch ETH price (#2118) --- src/state/application/hooks.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/state/application/hooks.ts b/src/state/application/hooks.ts index e8ed063c11..bda0ac3309 100644 --- a/src/state/application/hooks.ts +++ b/src/state/application/hooks.ts @@ -307,7 +307,6 @@ const getPrommEthPrice = async ( return [ethPrice, ethPriceOneDay, priceChangeETH] } -let fetchingETHPrice = false export function useETHPrice(version: string = VERSION.CLASSIC): AppState['application']['ethPrice'] { const dispatch = useDispatch() const { isEVM, chainId } = useActiveWeb3React() @@ -322,8 +321,6 @@ export function useETHPrice(version: string = VERSION.CLASSIC): AppState['applic if (!isEVM) return async function checkForEthPrice() { - if (fetchingETHPrice) return - fetchingETHPrice = true try { const [newPrice, oneDayBackPrice, pricePercentChange] = await (version === VERSION.ELASTIC ? getPrommEthPrice(isEnableBlockService, chainId, elasticClient, blockClient, controller.signal) @@ -342,8 +339,8 @@ export function useETHPrice(version: string = VERSION.CLASSIC): AppState['applic pricePercentChange, }), ) - } finally { - fetchingETHPrice = false + } catch (error) { + console.error('useETHPrice error:', { error }) } } checkForEthPrice()