WebUI: clear timer variable properly

In JS the timer handle pool is reused and therefore require careful handling of it.
This commit is contained in:
Chocobo1
2024-07-26 04:58:21 +08:00
parent 7131d1bd6b
commit bf7e1516d5
7 changed files with 18 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ window.qBittorrent.PropTrackers ??= (() => {
let current_hash = "";
const torrentTrackersTable = new window.qBittorrent.DynamicTable.TorrentTrackersTable();
let loadTrackersDataTimer;
let loadTrackersDataTimer = -1;
const loadTrackersData = function() {
if ($("prop_trackers").hasClass("invisible")
@@ -119,6 +119,7 @@ window.qBittorrent.PropTrackers ??= (() => {
const updateData = function() {
clearTimeout(loadTrackersDataTimer);
loadTrackersDataTimer = -1;
loadTrackersData();
};