diff --git a/src/pages/StatisticsChart/mining/DifficultyUncleRateEpoch.tsx b/src/pages/StatisticsChart/mining/DifficultyUncleRateEpoch.tsx index 5e842b1a6..955224627 100644 --- a/src/pages/StatisticsChart/mining/DifficultyUncleRateEpoch.tsx +++ b/src/pages/StatisticsChart/mining/DifficultyUncleRateEpoch.tsx @@ -1,7 +1,7 @@ import { FC } from 'react' import BigNumber from 'bignumber.js' import { useTranslation } from 'react-i18next' -import { assertSerialsDataIsString, assertIsArray, assertSerialsItem, handleAxis } from '../../../utils/chart' +import { assertIsArray, assertSerialsItem, handleAxis } from '../../../utils/chart' import { tooltipColor, tooltipWidth, SeriesItem, SmartChartPage } from '../common' import { parseHourFromMillisecond } from '../../../utils/date' import { ChartCachedKeys } from '../../../constants/cache' @@ -15,11 +15,11 @@ const widthSpan = (value: string, currentLanguage: LanuageType) => const useTooltip = () => { const { t } = useTranslation() const currentLanguage = useCurrentLanguage() - return ({ seriesName, data, color }: SeriesItem & { data: string }) => { - if (seriesName === t('block.epoch_time')) { + return ({ seriesName, data, color }: SeriesItem & { data?: number }) => { + if (seriesName === t('block.epoch_time') && typeof data === 'number') { return `
${tooltipColor(color)}${widthSpan(t('block.epoch_time'), currentLanguage)} ${data} h
` } - if (seriesName === t('block.epoch_length')) { + if (seriesName === t('block.epoch_length') && typeof data === 'number') { return `
${tooltipColor(color)}${widthSpan(t('block.epoch_length'), currentLanguage)} ${data}
` } return '' @@ -71,7 +71,6 @@ const useOption = ( }` dataList.forEach(data => { assertSerialsItem(data) - assertSerialsDataIsString(data) result += parseTooltip(data) }) return result