Repository navigation
fix(web): pause data polls while the tab is hidden or offline - #1605
Confidence 9/10 · No issues found
🟢 Confidence 9/10 · safe to merge
pollTicks cadence and catch-up are pinned by poll.test.ts; only the githubForcePoll presence wiring is untested.
1 note · tests partial −1 · risk medium
pollTicks replaces every setInterval data poll in the web app with a presence-aware tick, and the GitHub force-poll window now waits for the tab to be back before its last status read. The helper reads sound and is well tested; safe to merge.
pollTicksskips ticks while hidden/offline and ticks once on returneveryin the integrations page now mapspollTicksinstead ofsetIntervalgithubForcePolldefers its final read and end towhenPresent
Findings
🔵 Note · F1 · githubForcePoll's deferral has no test and cannot be driven
tests · apps/web/src/page/integrations/subscription.ts:279-281
The new window end emits a status read before EndedGithubForcePoll and waits for the tab to be back, but nothing exercises it: the integrations page has scene tests only, no subscription test. whenPresent() here takes the module's browserPresence, so a test cannot make the entry start hidden and assert the read still lands. Give the entry a Presence (as pollTicks accepts) and drive dependenciesToStream with a fake, asserting TickedGithubPoll precedes ended and that nothing is emitted while absent.
Thread a `Presence` into the entry (or test `dependenciesToStream` with a fake presence) and add a subscription test for the hidden-then-visible window end.
What was checked
Pollmode joins a read in flight (update-status.ts:55), so the catch-up and force-poll ticks cannot double-fetchwhenPresentresolves immediately when present;Stream.succeed+ lazily subscribedchangesloses no event- Drop rule verified by hand for catches 1 s and 8 s before the next tick (
poll.test.ts:68,:86)
7c61dc7 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Annotations
Check notice on line 281 in apps/web/src/page/integrations/subscription.ts
maple-review-bot / Maple / review
tests: `githubForcePoll`'s deferral has no test and cannot be driven
The new window end emits a status read before `EndedGithubForcePoll` and waits for the tab to be back, but nothing exercises it: the integrations page has scene tests only, no subscription test. `whenPresent()` here takes the module's `browserPresence`, so a test cannot make the entry start hidden and assert the read still lands. Give the entry a `Presence` (as `pollTicks` accepts) and drive `dependenciesToStream` with a fake, asserting `TickedGithubPoll` precedes `ended` and that nothing is emitted while absent.