* fix: Reward page render error #1006 * accept coderabbit's suggestion Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * address lint issues * use existing patterns --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com> Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
This commit is contained in:
parent
5fa7fd9a83
commit
2a08abd90c
|
@ -20,6 +20,7 @@ import { Col, Row } from 'react-bootstrap'
|
|||
import { proportions } from '@/lib/madness'
|
||||
import { useData } from '@/components/use-data'
|
||||
import { GrowthPieChartSkeleton } from '@/components/charts-skeletons'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
const GrowthPieChart = dynamic(() => import('@/components/charts').then(mod => mod.GrowthPieChart), {
|
||||
loading: () => <GrowthPieChartSkeleton />
|
||||
|
@ -95,15 +96,20 @@ export default function Rewards ({ ssrData }) {
|
|||
REWARDS,
|
||||
SSR ? {} : { pollInterval: 1000, nextFetchPolicy: 'cache-and-network' })
|
||||
const { data } = useQuery(REWARDS_FULL)
|
||||
if (!data && !ssrData) return <PageLoading />
|
||||
const dat = useData(data, ssrData)
|
||||
|
||||
let { rewards: [{ total, sources, time, leaderboard }] } = useMemo(() => {
|
||||
return dat || { rewards: [{}] }
|
||||
}, [dat])
|
||||
|
||||
let { rewards: [{ total, sources, time, leaderboard }] } = useData(data, ssrData)
|
||||
if (rewardsData?.rewards?.length > 0) {
|
||||
total = rewardsData.rewards[0].total
|
||||
sources = rewardsData.rewards[0].sources
|
||||
time = rewardsData.rewards[0].time
|
||||
}
|
||||
|
||||
if (!dat) return <PageLoading />
|
||||
|
||||
function EstimatedReward ({ rank }) {
|
||||
const totalRest = total - 1000000
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue