Fix item tree breakage if annotation is added while search is active

This commit is contained in:
Dan Stillman 2021-03-17 00:14:14 -04:00
parent bb2f1ced99
commit d5334dc483

View file

@ -1892,9 +1892,17 @@ Zotero.ItemTreeView.prototype.selectItems = async function (ids, noRecurse) {
var rowsToSelect = [];
for (let id of idsToSelect) {
let row = this._rowMap[id];
if (!row) {
Zotero.debug(`Item ${id} not in row map -- skipping`);
continue;
}
rowsToSelect.push(row);
}
if (!rowsToSelect.length) {
return 0;
}
// If items are already selected, just scroll to the top-most one
var selectedRows = new Set(this.getSelectedRowIndexes());
if (rowsToSelect.length == selectedRows.size && rowsToSelect.every(row => selectedRows.has(row))) {