Problem (audit D1 + D2)
Several timers run perpetually regardless of whether the window is visible — keeping the app awake when backgrounded/idle:
- D1:
modalManager.js setInterval(_scanAndWire, 1000) runs forever, looping auto-wire modal IDs and calling an idempotent injectMinimizeButton — nearly every tick is wasted, and the 1s wakeup never stops.
- D2:
emailInbox.js unread refresh (60s) and tasks.js notif poll (30s) fire network/work even when the tab is hidden. calendar.js already gates on document.visibilityState — the others should match.
Fix
- modalManager: pause the 1s interval when
document.hidden, resume on visibilitychange (identical behaviour when visible; no wakeups when hidden).
- email/tasks polls: early-return when
document.visibilityState !== 'visible' (same pattern calendar already uses).
Aligns with the idle-quiescence rule (#117). Affected: static/js/modalManager.js, static/js/emailInbox.js, static/js/tasks.js.
Problem (audit D1 + D2)
Several timers run perpetually regardless of whether the window is visible — keeping the app awake when backgrounded/idle:
modalManager.jssetInterval(_scanAndWire, 1000)runs forever, looping auto-wire modal IDs and calling an idempotentinjectMinimizeButton— nearly every tick is wasted, and the 1s wakeup never stops.emailInbox.jsunread refresh (60s) andtasks.jsnotif poll (30s) fire network/work even when the tab is hidden.calendar.jsalready gates ondocument.visibilityState— the others should match.Fix
document.hidden, resume onvisibilitychange(identical behaviour when visible; no wakeups when hidden).document.visibilityState !== 'visible'(same pattern calendar already uses).Aligns with the idle-quiescence rule (#117). Affected:
static/js/modalManager.js,static/js/emailInbox.js,static/js/tasks.js.