mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
808 B
808 B
Decisions: Explore Data Service Performance Optimization
Decision 1: Gate intervals with document.hidden
Context: setInterval runs unconditionally.
Choice: Add if (document.hidden) return; at the start of the interval callback.
Rationale: Simple, effective way to stop processing. clearInterval / setInterval on visibility change is more complex to manage state.
Decision 2: Add visibilitychange listener
Context: If we skip updates, data becomes stale.
Choice: Listen for visibilitychange. If visible, call refreshWatchHistoryTagCounts() and refreshTagIdf().
Rationale: Ensures that when the user returns, they see fresh data immediately (or very soon). The existing refresh... methods already handle debounce/staleness checks, so calling them is safe.