Skip to content

Polling Bug#502

Open
dewabisma wants to merge 4 commits into
mainfrom
beast/polling-bug
Open

Polling Bug#502
dewabisma wants to merge 4 commits into
mainfrom
beast/polling-bug

Conversation

@dewabisma
Copy link
Copy Markdown
Collaborator

@dewabisma dewabisma commented May 27, 2026

Summary

Fixed the bug of polling visited accounts even though not active.


Note

Medium Risk
Changes how pending transactions reconcile and how balances/history refresh on timers and account switches; incorrect scoping could leave stale UI or miss reconciliation for inactive accounts.

Overview
Background polling and history refresh no longer fan out across every wallet account or the global paginationControllerProvider. A new polling_refresh_scope helper centralizes active-account-only silent refresh, targeted balance invalidation, and account-switch refresh.

Global history polling now refreshes only the active account’s pagination (and only when that provider is already alive), awaits reconciliation, and triggers refreshActiveAccountOnSwitch when the selected account changes.

Pending tx silent refresh and reconciliation scope to affected parties plus the active account; reconciliation reads confirmed history from per-account filtered pagination instead of allTransactionsProvider, and refreshes non-active accounts only when their pagination cache exists.

Reversible transfer monitoring listens to the active account’s pagination stream instead of wallet-wide history, drops global pagination updates on execution, and limits balance invalidation to sender/receiver. updatePaginationFiltersFor can restrict which transaction filters are updated.

Unit tests cover refresh-target and reconciliation account ID scoping.

Reviewed by Cursor Bugbot for commit 0b4ee4a. Bugbot is set up for automated code reviews on this repo. Configure here.

@dewabisma dewabisma requested a review from n13 May 27, 2026 13:35
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0b4ee4a. Configure here.

try {
// Check if we have accounts available
final accountsState = _ref.read(accountsProvider);
if (accountsState.value?.isEmpty ?? true) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double timer scheduling causes orphaned polling timers

Medium Severity

When activeAccountId returns null, _scheduleNextPoll() is called inside the try block followed by return. Since the finally block always executes on return, _scheduleNextPoll() runs again, overwriting _pollingTimer and orphaning the first timer. The orphaned timer still fires, effectively doubling poll frequency. The new condition (activeId == null) is more easily triggered during normal operation (e.g., account switching or loading states) compared to the old condition (accounts empty), which was well-guarded by the listener that stops polling when accounts are empty.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0b4ee4a. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant