Skip to content

Commit 51d8710

Browse files
committed
WebUI: simplify removing elements from an array
Now it remove elements starting from the end of an array which should have better performance and succinct code.
1 parent 7297225 commit 51d8710

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/webui/www/private/scripts/dynamicTable.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -872,11 +872,9 @@ window.qBittorrent.DynamicTable ??= (() => {
872872
updateTable(fullUpdate = false) {
873873
const rows = this.getFilteredAndSortedRows();
874874

875-
for (let i = 0; i < this.selectedRows.length; ++i) {
876-
if (!(this.selectedRows[i] in rows)) {
875+
for (let i = this.selectedRows.length - 1; i >= 0; --i) {
876+
if (!(this.selectedRows[i] in rows))
877877
this.selectedRows.splice(i, 1);
878-
--i;
879-
}
880878
}
881879

882880
if (this.useVirtualList) {

0 commit comments

Comments
 (0)