diff --git a/src/routes/staking.tsx b/src/routes/staking.tsx index c891f77..0c9c369 100644 --- a/src/routes/staking.tsx +++ b/src/routes/staking.tsx @@ -184,8 +184,8 @@ const Staking = () => { const [userStakedInfoMap, setUserStakedInfoMap] = useState>(new Map()); const disableClaiming = useMemo(() => { - return isWaiting || unclaimedEras.total === 0 && totalUnclaimed.toNumber() === 0; - }, [isWaiting, unclaimedEras, totalUnclaimed]); + return isWaiting || unclaimedEras.total === 0; + }, [isWaiting, unclaimedEras]); const [rewardsUserClaimedQuery, reexecuteQuery] = useQuery({ query: TotalRewardsClaimedQuery, @@ -445,7 +445,7 @@ const Staking = () => { }, [claimAllSuccess, reexecuteQuery]); const handleClaimRewards = useCallback(async () => { - if (!selectedAccount || !unclaimedEras || !currentStakingEra) return; + if (disableClaiming || !selectedAccount || !unclaimedEras || !currentStakingEra) return; await restakeClaim({ api, @@ -526,7 +526,7 @@ const Staking = () => { rewardsUserClaimedQuery.data.stakers[0].totalUnclaimed ); setTotalUnclaimed(totalUnclaimed); - }, [rewardsUserClaimedQuery, selectedAccount, rewardsUserClaimedQuery.fetching, rewardsUserClaimedQuery.data, claimAllSuccess]); + }, [rewardsUserClaimedQuery, selectedAccount, rewardsUserClaimedQuery.fetching, rewardsUserClaimedQuery.data]); return (