diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index da09a8d9e3..067b8b7bcb 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -114,6 +114,7 @@ Zotero.CollectionTreeView.prototype.setTree = Zotero.Promise.coroutine(function* if (!selected) { this.selection.select(0); } + this.selection.selectEventsSuppressed = false; yield this._runListeners('load'); this._initialized = true; @@ -129,9 +130,10 @@ Zotero.CollectionTreeView.prototype.setTree = Zotero.Promise.coroutine(function* }); -/* - * Reload the rows from the data access methods - * (doesn't call the tree.invalidate methods, etc.) +/** + * Rebuild the tree from the data access methods and clear the selection + * + * Calling code must invalidate the tree, restore the selection, and unsuppress selection events */ Zotero.CollectionTreeView.prototype.refresh = Zotero.Promise.coroutine(function* () { @@ -225,6 +227,7 @@ Zotero.CollectionTreeView.prototype.refresh = Zotero.Promise.coroutine(function* } } + this.selection.selectEventsSuppressed = true; this.selection.clearSelection(); this._rows = newRows; this.rowCount = this._rows.length; diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 047b6dac29..827753b40c 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -68,8 +68,7 @@ Zotero.ItemTreeView.prototype.type = 'item'; /** * Called by the tree itself */ -Zotero.ItemTreeView.prototype.setTree = Zotero.serial(Zotero.Promise.coroutine(function* (treebox) -{ +Zotero.ItemTreeView.prototype.setTree = Zotero.Promise.coroutine(function* (treebox) { try { Zotero.debug("Setting tree for " + this.collectionTreeRow.id + " items view " + this.id); var start = Date.now(); @@ -272,7 +271,7 @@ Zotero.ItemTreeView.prototype.setTree = Zotero.serial(Zotero.Promise.coroutine(f } throw e; } -})); +}); /**