Skip to content

Commit de2c065

Browse files
committed
chore: loading state
1 parent 8a8000c commit de2c065

File tree

1 file changed

+19
-13
lines changed
  • apps/web/src/app/(networks)/(evm)/claim

1 file changed

+19
-13
lines changed

apps/web/src/app/(networks)/(evm)/claim/hero.tsx

+19-13
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,34 @@ import { formatUSD } from 'sushi/format'
99
import { useAccount } from 'wagmi'
1010

1111
export const Hero: FC = () => {
12-
const { address } = useAccount()
12+
const { address, isConnected } = useAccount()
1313

1414
const { data: positionsData } = useConcentratedLiquidityPositions({
1515
account: address,
1616
chainIds: SushiSwapV3ChainIds,
1717
})
1818
const totalFeesUSD = useMemo(() => {
19-
return positionsData?.reduce(
20-
(accum, { position: { unclaimedUSD } }) => accum + unclaimedUSD,
21-
0,
22-
)
23-
}, [positionsData])
19+
return !isConnected
20+
? 0
21+
: positionsData
22+
? positionsData.reduce(
23+
(accum, { position: { unclaimedUSD } }) => accum + unclaimedUSD,
24+
0,
25+
)
26+
: undefined
27+
}, [positionsData, isConnected])
2428

2529
const { data: rewardsData } = useClaimableRewards({ account: address })
2630
const totalRewardsUSD = useMemo(() => {
27-
return rewardsData
28-
? Object.values(rewardsData).reduce(
29-
(accum, { totalRewardsUSD }) => accum + totalRewardsUSD,
30-
0,
31-
)
32-
: undefined
33-
}, [rewardsData])
31+
return !isConnected
32+
? 0
33+
: rewardsData
34+
? Object.values(rewardsData).reduce(
35+
(accum, { totalRewardsUSD }) => accum + totalRewardsUSD,
36+
0,
37+
)
38+
: undefined
39+
}, [rewardsData, isConnected])
3440

3541
return (
3642
<section className="flex flex-col gap-6">

0 commit comments

Comments
 (0)