From 8991d994c2b41b6e3a12dfb1f7c5883a4f96e83c Mon Sep 17 00:00:00 2001 From: Thomas Piccirello <8296030+Piccirello@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:34:17 -0700 Subject: [PATCH] WebUI: Eliminate unnecessary torrents table updates Only update the torrents table when torrents are added, edited, or removed. PR #21656. --- src/webui/www/private/scripts/client.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 21c6a9604..1f3562caf 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -752,12 +752,14 @@ window.addEventListener("DOMContentLoaded", () => { 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(); update_categories = true; updateTags = true; updateTrackers = true; + updateTorrents = true; torrentsTable.clear(); category_list.clear(); tagList.clear(); @@ -864,6 +866,7 @@ window.addEventListener("DOMContentLoaded", () => { update_categories = true; if (addTorrentToTagList(response["torrents"][key])) updateTags = true; + updateTorrents = true; } } if (response["torrents_removed"]) { @@ -874,8 +877,13 @@ window.addEventListener("DOMContentLoaded", () => { removeTorrentFromTagList(hash); updateTags = true; // Always to update All tag }); + updateTorrents = true; } - torrentsTable.updateTable(full_update); + + // don't update the table unnecessarily + if (updateTorrents) + torrentsTable.updateTable(full_update); + if (response["server_state"]) { const tmp = response["server_state"]; for (const k in tmp) {