Skip to content

Commit

Permalink
fix: can't fetch ETH price
Browse files Browse the repository at this point in the history
  • Loading branch information
namgold committed Jul 25, 2023
1 parent a7710fd commit eb3eadb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/state/application/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit eb3eadb

Please sign in to comment.