From 69b5d6d62c5f7ad5305a56c0034b5b6194e6d392 Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Thu, 30 May 2024 04:02:49 +0200 Subject: [PATCH] Fix refreshing transactions after making a debonding transaction Debonding transactions don't change "available" balance --- .changelog/1963.bugfix.md | 1 + src/app/state/account/saga.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changelog/1963.bugfix.md diff --git a/.changelog/1963.bugfix.md b/.changelog/1963.bugfix.md new file mode 100644 index 0000000000..f7bb8d3513 --- /dev/null +++ b/.changelog/1963.bugfix.md @@ -0,0 +1 @@ +Fix refreshing transactions after making a debonding transaction diff --git a/src/app/state/account/saga.ts b/src/app/state/account/saga.ts index edd819ebe0..88301bd02d 100644 --- a/src/app/state/account/saga.ts +++ b/src/app/state/account/saga.ts @@ -10,7 +10,7 @@ import { fetchAccount as stakingFetchAccount } from '../staking/saga' import { refreshAccount as walletRefreshAccount } from '../wallet/saga' import { transactionActions } from '../transaction' import { selectAddress } from '../wallet/selectors' -import { selectAccountAddress, selectAccountAvailableBalance } from './selectors' +import { selectAccountAddress, selectAccount } from './selectors' import { getAccountBalanceWithFallback } from '../../lib/getAccountBalanceWithFallback' import { walletActions } from '../wallet' @@ -110,7 +110,7 @@ export function* fetchingOnAccountPage() { yield* put(stakingActions.fetchAccount(address)) yield* take(accountActions.accountLoaded) - // Start refetching balance. If balance changes then fetch transactions and staking too. + // Continuously refresh balance. If balance changes then fetch transactions and staking too. while (true) { yield* delay(ACCOUNT_REFETCHING_INTERVAL) if (document.hidden) continue @@ -123,8 +123,13 @@ export function* fetchingOnAccountPage() { console.error('refetching account failed, continuing without updated account.', apiError) continue // Ignore error when refetching, and don't fallback to more expensive gRPC } - const staleAvailableBalance = yield* select(selectAccountAvailableBalance) - if (staleAvailableBalance !== refreshedAccount.available) { + + const staleBalances = yield* select(selectAccount) + if ( + staleBalances.available !== refreshedAccount.available || + staleBalances.delegations !== refreshedAccount.delegations || + staleBalances.debonding !== refreshedAccount.debonding + ) { yield* call(fetchAccount, startAction) yield* call(stakingFetchAccount, startAction) yield* call(walletRefreshAccount, address)