Skip to content

Commit

Permalink
fix(suite-common): current account state in txn fetch thunk
Browse files Browse the repository at this point in the history
  • Loading branch information
vytick committed Jul 8, 2024
1 parent 35edf9b commit 814ab5d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,15 @@ export const fetchTransactionsPageThunk = createThunk(
suppressBackupWarning: true,
});

// Account might have changed during async getAccountInfo call, so we fetch current state
const currentAccount = selectAccountByKey(getState(), accountKey);

if (!currentAccount) {
throw new Error(`Account not found: ${accountKey}`);
}

if (result && result.success) {
const updateAction = accountsActions.updateAccount(account, result.payload);
const updateAction = accountsActions.updateAccount(currentAccount, result.payload);
const updatedAccount = updateAction.payload;
const updatedTransactions = result.payload.history.transactions || [];

Expand Down

0 comments on commit 814ab5d

Please sign in to comment.