From f3d6a1d21052c56f37900ab09bc503b398acc178 Mon Sep 17 00:00:00 2001 From: Venom <184024755+0xcryptovenom@users.noreply.github.com> Date: Sun, 24 Nov 2024 12:48:02 +0100 Subject: [PATCH] fix stake page should use fetchWalletBalances thunk async action (#578) --- src/pages/stake/index.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/pages/stake/index.tsx b/src/pages/stake/index.tsx index d35fc1933..02f82c5bb 100644 --- a/src/pages/stake/index.tsx +++ b/src/pages/stake/index.tsx @@ -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(); } }; @@ -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(); } }; @@ -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; @@ -399,7 +396,6 @@ export default function Stake({ alpRewards.pendingGenesisAdxRewards = 0; fetchAlpRewards(); } - triggerWalletStakingAccountsReload(); if (tokenSymbol === 'ADX') { setOptimisticClaimAdx([optimisticClaim]); @@ -408,7 +404,8 @@ export default function Stake({ } } catch (error) { console.error('error', error); - triggerWalletTokenBalancesReload(); + } finally { + dispatch(fetchWalletTokenBalances()); triggerWalletStakingAccountsReload(); } };