Skip to content

Commit

Permalink
WebUI: Eliminate unnecessary Status filter list updates
Browse files Browse the repository at this point in the history
Only update the Status filter list when torrents are removed, added or their state changed.

PR #21866.
  • Loading branch information
skomerko authored Nov 22, 2024
1 parent 6ce2869 commit 7300b9f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/webui/www/private/scripts/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,15 @@ window.addEventListener("DOMContentLoaded", () => {
torrentsFilterInputTimer = -1;

let torrentsTableSelectedRows;
let updateStatuses = false;
let update_categories = false;
let updateTags = false;
let updateTrackers = false;
let updateTorrents = false;
const full_update = (response["full_update"] === true);
if (full_update) {
torrentsTableSelectedRows = torrentsTable.selectedRowsIds();
updateStatuses = true;
update_categories = true;
updateTags = true;
updateTrackers = true;
Expand Down Expand Up @@ -870,6 +872,7 @@ window.addEventListener("DOMContentLoaded", () => {
const state = response["torrents"][key]["state"];
response["torrents"][key]["status"] = state;
response["torrents"][key]["_statusOrder"] = statusSortOrder[state];
updateStatuses = true;
}
torrentsTable.updateRowData(response["torrents"][key]);
if (addTorrentToCategoryList(response["torrents"][key]))
Expand All @@ -888,6 +891,7 @@ window.addEventListener("DOMContentLoaded", () => {
updateTags = true; // Always to update All tag
});
updateTorrents = true;
updateStatuses = true;
}

// don't update the table unnecessarily
Expand All @@ -903,7 +907,10 @@ window.addEventListener("DOMContentLoaded", () => {
}
processServerState();
}
updateFiltersList();

if (updateStatuses)
updateFiltersList();

if (update_categories) {
updateCategoryList();
window.qBittorrent.TransferList.contextMenu.updateCategoriesSubMenu(category_list);
Expand Down

0 comments on commit 7300b9f

Please sign in to comment.