Skip to content

Commit

Permalink
fix: disable call fetch latest-block-number when no need
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Feb 22, 2023
1 parent b20c7c7 commit 1eb695d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions views/homepage/MarketStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ function getLastestBlock(latestBlock: LatestBlock) {

const MarketStatistics = ({ classes, hasFetchLatestBlock, commonStatsData, estimateCountedData }: Props) => {
const { isMobile } = useMobileLayout('small')
const _fetchCondition = key => {
switch (key) {
case 'latest_block':
return [API_LIST.LATEST_BLOCK]
}
const _fetchCondition = () => {
if (!hasFetchLatestBlock) return ''
return [API_LIST.LATEST_BLOCK]
}
const { data: latestBlockRaw, error: latestBlockError } = useSWR<LatestBlock>(_fetchCondition('latest_block'), {
const { data: latestBlockRaw, error: latestBlockError } = useSWR<LatestBlock>(_fetchCondition(), {
refreshInterval: 2000
})

Expand Down

0 comments on commit 1eb695d

Please sign in to comment.