Skip to content

feat: make stats polling visibility aware#42

Closed
gaoflow wants to merge 1 commit into
StableRoute-Org:mainfrom
gaoflow:enhancement/stats-10-visibility-polling
Closed

feat: make stats polling visibility aware#42
gaoflow wants to merge 1 commit into
StableRoute-Org:mainfrom
gaoflow:enhancement/stats-10-visibility-polling

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 21, 2026

Copy link
Copy Markdown

Summary

  • pause stats polling while document.visibilityState is hidden
  • resume with an immediate fetch when the tab becomes visible again
  • add a manual Refresh button and Last updated indicator
  • keep the last good stats visible after an error and stop interval retries
  • replace inline tiles with shared StatTile

Closes #10

Tests

  • npm test -- src/app/stats/page.test.tsx --runInBand
  • npm run lint
  • npm test -- --runInBand
  • npm run build
  • NEXT_PUBLIC_STABLEROUTE_API_BASE=http://localhost:3011 npm run build
  • Rendered smoke: started a temporary mock stats API on 3011 and production Next server on 3010, then captured /stats with Playwright CLI.

Browser runtime fallback: the in-app Browser was available as a skill, but the runtime returned Browser is not available: iab; I used Playwright CLI screenshots instead.

Screenshot evidence saved locally:

  • /tmp/stableroute-stats-visibility-polling.png

@mikewheeleer

Copy link
Copy Markdown
Contributor

thanks for jumping in @gaoflow! 🙏 we assign issues before work starts so two people don't build the same thing, and #10 isn't assigned to you. please grab an open unassigned issue and PR against that. closing this one for now, hope to see you back 💪

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.

Pause stats polling when the browser tab is hidden and add a manual refresh

2 participants