Skip to content

Commit 10456e2

Browse files
strzelecadam-strzelec
authored andcommitted
fix: user who voted but not staked can claim
1 parent 197ca22 commit 10456e2

File tree

1 file changed

+7
-4
lines changed
  • src/components/v5/common/ActionSidebar/partials/Motions/steps/FinalizeStep

1 file changed

+7
-4
lines changed

src/components/v5/common/ActionSidebar/partials/Motions/steps/FinalizeStep/hooks.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,14 @@ export const useClaimConfig = (
155155
}
156156
}, [stakerReward?.isClaimed, isClaimed]);
157157

158+
const userReward = voterRewards?.items.find(
159+
(voterReward) => voterReward?.userAddress === userAddress,
160+
);
161+
158162
const userVoteRewardAmount = useMemo(() => {
159163
if (!userAddress || !voterRewards?.items) {
160164
return 0;
161165
}
162-
const userReward = voterRewards.items.find(
163-
(voterReward) => voterReward?.userAddress === userAddress,
164-
);
165166

166167
if (!userReward) {
167168
return 0;
@@ -199,7 +200,9 @@ export const useClaimConfig = (
199200
// Else, return full widget
200201
const buttonTextId = isClaimed ? 'button.claimed' : 'button.claim';
201202
const remainingStakesNumber = remainingStakes.length;
202-
const canClaimStakes = userTotalStake ? !userTotalStake.isZero() : false;
203+
const canClaimStakes = userTotalStake
204+
? !userTotalStake.isZero()
205+
: !!userReward;
203206
const handleClaimSuccess = () => {
204207
setIsClaimed(true);
205208
startPollingAction(getSafePollingInterval());

0 commit comments

Comments
 (0)