-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Summary
_initIdleWatcher in js/activity.js adds multiple global event listeners and a periodic setInterval, but the cleanup path is not managed through Activity lifecycle teardown.
Code references
js/activity.js:2952(this._initIdleWatcher = () => { ... })js/activity.js:2972window.addEventListener(mousemove, resetIdleTimer);js/activity.js:2973window.addEventListener(mousedown, resetIdleTimer);js/activity.js:2974window.addEventListener(keydown, resetIdleTimer);js/activity.js:2975window.addEventListener(touchstart, resetIdleTimer);js/activity.js:2976window.addEventListener(wheel, resetIdleTimer);js/activity.js:2979setInterval(() => { ... }, 1000);
Why this matters
If Activity is reinitialized/reset in the same page session, additional listeners and intervals can accumulate, causing duplicated work, extra wakeups, and unnecessary CPU/battery use.
Expected behavior
- Track idle watcher listener handlers and interval id.
- Register listeners via managed lifecycle utilities (
addEventListenertracker or equivalent). - Clear the interval and detach listeners during teardown/reset.
Suggested fix
Introduce startIdleWatcher() / stopIdleWatcher() (or equivalent) and call stop in existing cleanup paths before reinit.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels