diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index 1193e8f5e2..5ffd876dad 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -1180,6 +1180,13 @@ class VirtualizedTable extends React.Component { focus() { setTimeout(() => this._topDiv.focus()); } + + + rowIsVisible(row) { + if (!this._jsWindow) return false; + return row >= this._jsWindow.getFirstVisibleRow() + && row <= this._jsWindow.getLastVisibleRow(); + } } /** diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 4998cf597b..c94ccf0554 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -1468,6 +1468,12 @@ var ItemTree = class ItemTree extends LibraryTree { indices = Array.from(indices).filter(index => index < this._rows.length); indices.sort((a, b) => a - b); + // If all rows are already visible, don't do anything + if (indices.every(x => this.tree.rowIsVisible(x))) { + //Zotero.debug("All indices are already visible"); + return; + } + var indicesWithParents = []; for (let row of indices) { let parent = this.getParentIndex(row);