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

@@ -72,7 +72,7 @@ window.qBittorrent.PropGeneral ??= (() => {
piecesBar.clear();
};
let loadTorrentDataTimer;
let loadTorrentDataTimer = -1;
const loadTorrentData = function() {
if ($("prop_general").hasClass("invisible")
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
@@ -250,6 +250,7 @@ window.qBittorrent.PropGeneral ??= (() => {
const updateData = function() {
clearTimeout(loadTorrentDataTimer);
loadTorrentDataTimer = -1;
loadTorrentData();
};