From afc901b3aedb8719dbbccf82fcc9cf576375849b Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Tue, 17 Jun 2025 14:51:20 -0700 Subject: [PATCH] Delete correct rows after re-sort The previous logic assumed that `trs` was properly sorted, which is no longer the case. --- 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 bb4492a86..fab80d379 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -883,6 +883,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) { @@ -901,10 +902,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(); } }