From 67ef356064dafc7535aa665e645be994528bd251 Mon Sep 17 00:00:00 2001 From: Thomas Piccirello <8296030+Piccirello@users.noreply.github.com> Date: Sun, 22 Jun 2025 03:35:07 -0400 Subject: [PATCH] WebUI: Delete correct rows after re-sort The previous logic assumed that trs was properly sorted, which is no longer the case. Follow up to #22827. PR #22884. --- src/webui/www/private/scripts/dynamicTable.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 539b003d3..032a79a1e 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -886,6 +886,7 @@ window.qBittorrent.DynamicTable ??= (() => { for (let rowPos = 0; rowPos < rows.length; ++rowPos) { const { rowId } = rows[rowPos]; const tr = trMap.get(rowId); + trMap.delete(rowId); const isInCorrectLocation = rowId === trs[rowPos]?.rowId; if (!isInCorrectLocation) { @@ -904,10 +905,8 @@ window.qBittorrent.DynamicTable ??= (() => { prevTr = tr; } - const rowPos = rows.length; - - while ((rowPos < trs.length) && (trs.length > 0)) - trs.pop().remove(); + for (const tr of trMap.values()) + tr.remove(); } }