From 3d5856bdbb65401eab97bf2006db9a3b6b26564c Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Sat, 1 Jun 2024 03:13:48 +0200 Subject: [PATCH] Fix updating transactions list by adding more delay --- .changelog/1967.bugfix.md | 1 + playwright/tests/refreshing-balance.spec.ts | 2 ++ src/app/state/account/saga.ts | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 .changelog/1967.bugfix.md diff --git a/.changelog/1967.bugfix.md b/.changelog/1967.bugfix.md new file mode 100644 index 0000000000..33559facba --- /dev/null +++ b/.changelog/1967.bugfix.md @@ -0,0 +1 @@ +Fix updating transactions list by adding more delay diff --git a/playwright/tests/refreshing-balance.spec.ts b/playwright/tests/refreshing-balance.spec.ts index 2446f4f83d..9be7883037 100644 --- a/playwright/tests/refreshing-balance.spec.ts +++ b/playwright/tests/refreshing-balance.spec.ts @@ -33,11 +33,13 @@ test('Account selector should refresh balances on network change', async ({ page }) test('Accounts page should continuously refresh balance', async ({ page }) => { + test.setTimeout(120_000) await page.getByTestId('account-selector').click() await expect(page.getByTestId('account-balance-summary')).toContainText('123.0') await expect(page.getByTestId('account-choice')).toContainText('123.0') await mockApi(page, 456) await page.waitForRequest('**/chain/account/info/*', { timeout: 60_000 }) + await page.waitForRequest('**/chain/transactions*', { timeout: 60_000 }) await expect(page.getByTestId('account-balance-summary')).toContainText('456.0') await expect(page.getByTestId('account-choice')).toContainText('456.0') // If balance in AccountSelector is not refreshed then making transactions with new balance will fail. diff --git a/src/app/state/account/saga.ts b/src/app/state/account/saga.ts index 88301bd02d..53126ba466 100644 --- a/src/app/state/account/saga.ts +++ b/src/app/state/account/saga.ts @@ -15,6 +15,7 @@ import { getAccountBalanceWithFallback } from '../../lib/getAccountBalanceWithFa import { walletActions } from '../wallet' const ACCOUNT_REFETCHING_INTERVAL = process.env.REACT_APP_E2E_TEST ? 5 * 1000 : 30 * 1000 +const TRANSACTIONS_UPDATE_DELAY = 35 * 1000 // Measured between 8 and 31 second additional delay after balance updates const TRANSACTIONS_LIMIT = 20 export function* fetchAccount(action: PayloadAction) { @@ -130,6 +131,8 @@ export function* fetchingOnAccountPage() { staleBalances.delegations !== refreshedAccount.delegations || staleBalances.debonding !== refreshedAccount.debonding ) { + // Wait for oasisscan to update transactions (it updates balances faster) + yield* delay(TRANSACTIONS_UPDATE_DELAY) yield* call(fetchAccount, startAction) yield* call(stakingFetchAccount, startAction) yield* call(walletRefreshAccount, address)