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
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
7 changed files with 18 additions and 8 deletions

View file

@ -306,6 +306,8 @@ window.qBittorrent.PropFiles ??= (() => {
return;
clearTimeout(loadTorrentFilesDataTimer);
loadTorrentFilesDataTimer = -1;
new Request({
url: "api/v2/torrents/filePrio",
method: "post",
@ -331,7 +333,7 @@ window.qBittorrent.PropFiles ??= (() => {
torrentFilesTable.updateTable(false);
};
let loadTorrentFilesDataTimer;
let loadTorrentFilesDataTimer = -1;
const loadTorrentFilesData = function() {
if ($("prop_files").hasClass("invisible")
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
@ -378,6 +380,7 @@ window.qBittorrent.PropFiles ??= (() => {
const updateData = function() {
clearTimeout(loadTorrentFilesDataTimer);
loadTorrentFilesDataTimer = -1;
loadTorrentFilesData();
};