Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix for updating transactions list by adding more delay #1967

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/1967.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix updating transactions list by adding more delay
2 changes: 2 additions & 0 deletions playwright/tests/refreshing-balance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/app/state/account/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
lubej marked this conversation as resolved.
Show resolved Hide resolved
const TRANSACTIONS_LIMIT = 20

export function* fetchAccount(action: PayloadAction<string>) {
Expand Down Expand Up @@ -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)
lubej marked this conversation as resolved.
Show resolved Hide resolved
yield* call(fetchAccount, startAction)
yield* call(stakingFetchAccount, startAction)
yield* call(walletRefreshAccount, address)
Expand Down
Loading