WebUI: Fix row collapsing with virtual list enabled

Fixes https://github.com/qbittorrent/qBittorrent/issues/23241#issuecomment-3295352816.
PR #23542.
This commit is contained in:
tehcneko
2025-11-30 19:13:10 +08:00
committed by GitHub
parent a77b17e6da
commit 564afc975f
2 changed files with 13 additions and 3 deletions

View File

@@ -2359,6 +2359,9 @@ window.qBittorrent.DynamicTable ??= (() => {
for (const [key, _] of this.collapseState)
this.expandNode(key);
if (this.useVirtualList)
this.rerender();
}
collapseAllNodes() {
@@ -2370,6 +2373,9 @@ window.qBittorrent.DynamicTable ??= (() => {
if (state.depth >= 1)
this.collapseNode(key);
}
if (this.useVirtualList)
this.rerender();
}
#updateNodeVisibility(node, shouldHide) {
@@ -2741,8 +2747,10 @@ window.qBittorrent.DynamicTable ??= (() => {
generateRowsSignature() {
const rowsData = [];
for (const { rowId } of this.getRowValues())
rowsData.push({ ...this.getNode(rowId).serialize(), collapsed: this.isCollapsed(rowId) });
for (const { rowId } of this.getRowValues()) {
const node = this.getNode(rowId);
rowsData.push({ ...node.serialize(), collapsed: this.isCollapsed(node.rowId) });
}
return JSON.stringify(rowsData);
}
@@ -2771,7 +2779,7 @@ window.qBittorrent.DynamicTable ??= (() => {
// sort, then filter
this.#sortNodesByColumn(root, this.columns[this.sortedColumn]);
const rows = (() => {
if (this.filterTerms.length === 0) {
if (!this.useVirtualList && (this.filterTerms.length === 0)) {
const nodeArray = this.fileTree.toArray();
const filteredRows = nodeArray.map(node => this.getRow(node));
return filteredRows;