[codex] Pause ticker while panel is hidden#490
Open
zergzorg wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useNowTickerintervals whiledocument.hiddenis true by defaultnowimmediately when the document becomes visible again, before the next interval tickWhy
useNowTickerdrives 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: falseif a future use case needs it.Validation
node ./node_modules/vitest/vitest.mjs run src/hooks/use-now-ticker.test.tsPATH="/Users/ai/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" bun run buildnode ./node_modules/vitest/vitest.mjs runThe full Vitest run passes. Existing tests print Tauri store mock stderr in
App.test.tsx, but the suite exits successfully.Summary by cubic
Pause
useNowTickerticks while the document is hidden to reduce idle updates, and resume with an immediate refresh when it becomes visible. Adds apauseWhenHiddenoption (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