Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebUI: Eliminate unnecessary Status filter list updates #21866

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading