WebUI: Don't update UI if the page is hidden

Currently, there is unnecessary CPU/network usage by the web UI when it's running in the background, this PR prevents it from refreshing in the background.

Closes #22565.
PR #22567.
This commit is contained in:
bolshoytoster
2025-04-21 10:23:09 +01:00
committed by GitHub
parent 0187f19f60
commit 0160aa28b6
7 changed files with 30 additions and 0 deletions

View File

@@ -43,6 +43,8 @@ window.qBittorrent.PropTrackers ??= (() => {
let loadTrackersDataTimer = -1;
const loadTrackersData = () => {
if (document.hidden)
return;
if ($("propTrackers").classList.contains("invisible")
|| $("propertiesPanel_collapseToggle").classList.contains("panel-expand")) {
// Tab changed, don't do anything