diff --git a/chrome/content/zotero/xpcom/data/dataObjects.js b/chrome/content/zotero/xpcom/data/dataObjects.js index 147e9d73a..4a0f75f44 100644 --- a/chrome/content/zotero/xpcom/data/dataObjects.js +++ b/chrome/content/zotero/xpcom/data/dataObjects.js @@ -530,6 +530,8 @@ Zotero.DataObjects.prototype._diffCreators = function (data1, data2) { } Zotero.DataObjects.prototype._diffCollections = function (data1, data2) { + // Child items shouldn't have collections properties, but just in case one does + if (!data2) return false; if (data1.length != data2.length) return false; let c1 = data1.concat(); let c2 = data2.concat(); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 2b8c4a216..648cb3b0a 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -4216,10 +4216,12 @@ Zotero.Item.prototype.toJSON = Zotero.Promise.coroutine(function* (options) { } // Collections - yield this.loadCollections(); - obj.collections = this.getCollections().map(function (id) { - return this.ContainerObjectsClass.getLibraryAndKeyFromID(id).key; - }.bind(this)); + if (this.isTopLevelItem()) { + yield this.loadCollections(); + obj.collections = this.getCollections().map(function (id) { + return this.ContainerObjectsClass.getLibraryAndKeyFromID(id).key; + }.bind(this)); + } // Relations yield this.loadRelations();