Skip to content

[codex] Pause ticker while panel is hidden#490

Open
zergzorg wants to merge 1 commit into
robinebers:mainfrom
zergzorg:codex/pause-hidden-ticker
Open

[codex] Pause ticker while panel is hidden#490
zergzorg wants to merge 1 commit into
robinebers:mainfrom
zergzorg:codex/pause-hidden-ticker

Conversation

@zergzorg
Copy link
Copy Markdown
Contributor

@zergzorg zergzorg commented May 22, 2026

Summary

  • pause useNowTicker intervals while document.hidden is true by default
  • refresh now immediately when the document becomes visible again, before the next interval tick
  • add hook coverage for initially hidden documents, active ticker pause/resume, and opt-out behavior

Why

useNowTicker drives display-only UI such as countdowns and relative timestamps. When the menu panel WebView is hidden, those React timer updates do not change visible UI but can still wake the app. Pausing the ticker while hidden reduces idle UI work without changing provider probes or background refresh scheduling.

This addresses #488 and complements the broader resource-budget discussion in #487.

Notes

The default behavior is visibility-aware, but callers can keep the old hidden ticking behavior with pauseWhenHidden: false if a future use case needs it.

Validation

  • node ./node_modules/vitest/vitest.mjs run src/hooks/use-now-ticker.test.ts
  • PATH="/Users/ai/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" bun run build
  • node ./node_modules/vitest/vitest.mjs run

The full Vitest run passes. Existing tests print Tauri store mock stderr in App.test.tsx, but the suite exits successfully.


Summary by cubic

Pause useNowTicker ticks while the document is hidden to reduce idle updates, and resume with an immediate refresh when it becomes visible. Adds a pauseWhenHidden option (default true) plus tests for initial hidden state, pause/resume, and opt‑out behavior.

Written for commit 2c0614e. Summary will update on new commits. Review in cubic

@github-actions github-actions Bot added the core label May 22, 2026
@zergzorg zergzorg marked this pull request as ready for review May 22, 2026 11:33
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant