Skip to content

perf: Pause background polling when browser tab is hidden #157

Description

@Austinaminu2

Description

The dashboard polls the Soroban RPC every 5-30 seconds for stream updates. This continues even when the user switches to a different tab or minimizes the browser, wasting bandwidth, battery, and RPC rate limit quota.

Proposed Solution

Use the Page Visibility API to pause polling when the tab is hidden and resume when it becomes visible again.

document.addEventListener('visibilitychange', () => {
  if (document.hidden) {
    pausePolling();
  } else {
    resumePolling();
    // Immediately fetch fresh data on tab focus
    refetchStreams();
  }
});

Acceptance Criteria

  • Polling pauses when the browser tab is hidden or minimized
  • Polling resumes immediately when the tab becomes visible
  • A fresh data fetch triggers on tab re-focus (no stale data shown)
  • Works correctly with multiple FlowStar tabs open
  • No impact on auto-withdraw scheduling (if enabled, that should continue)
  • Add a brief "Refreshing..." indicator when resuming after a long hidden period

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendNext.js frontendperformancePerformance optimization

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions