Skip to content

Commit

Permalink
fix stake page should use fetchWalletBalances thunk async action (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcryptovenom authored Nov 24, 2024
1 parent adbc617 commit f3d6a1d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/pages/stake/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,11 @@ export default function Stake({
notification,
});

dispatch(fetchWalletTokenBalances());
triggerWalletStakingAccountsReload();
setUpgradeLockedStake(false);
} catch (error) {
console.error('error', error);
triggerWalletTokenBalancesReload();
} finally {
dispatch(fetchWalletTokenBalances());
triggerWalletStakingAccountsReload();
}
};
Expand Down Expand Up @@ -326,15 +325,14 @@ export default function Stake({
notification,
});

dispatch(fetchWalletTokenBalances());
triggerWalletStakingAccountsReload();
if (earlyExit) {
setLockedStake(null);
setFinalizeLockedStakeRedeem(false);
}
} catch (error) {
console.error('error', error);
triggerWalletTokenBalancesReload();
} finally {
dispatch(fetchWalletTokenBalances());
triggerWalletStakingAccountsReload();
}
};
Expand Down Expand Up @@ -386,7 +384,6 @@ export default function Stake({
source: 'optimistic',
} as unknown as ClaimHistoryExtended;

dispatch(fetchWalletTokenBalances());
// Reset rewards in the ui until next fetch
if (tokenSymbol === 'ADX') {
adxRewards.pendingUsdcRewards = 0;
Expand All @@ -399,7 +396,6 @@ export default function Stake({
alpRewards.pendingGenesisAdxRewards = 0;
fetchAlpRewards();
}
triggerWalletStakingAccountsReload();

if (tokenSymbol === 'ADX') {
setOptimisticClaimAdx([optimisticClaim]);
Expand All @@ -408,7 +404,8 @@ export default function Stake({
}
} catch (error) {
console.error('error', error);
triggerWalletTokenBalancesReload();
} finally {
dispatch(fetchWalletTokenBalances());
triggerWalletStakingAccountsReload();
}
};
Expand Down

0 comments on commit f3d6a1d

Please sign in to comment.