From b59fa1eed9e4403c9d92d5aef0c1887bded8aea5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 1 Jun 2015 19:58:01 -0400 Subject: [PATCH] Store copy of changed object in _markFieldChange() Otherwise a splice() on a stored array affects the calculation of what's new. --- chrome/content/zotero/xpcom/data/dataObject.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index 3a3ed4f612..199d9f7e28 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -556,10 +556,16 @@ Zotero.DataObject.prototype._markAllDataTypeLoadStates = function (loaded) { */ Zotero.DataObject.prototype._markFieldChange = function (field, oldValue) { // Only save if object already exists and field not already changed - if (!this.id || typeof this._previousData[field] != 'undefined') { + if (!this.id || this._previousData[field] !== undefined) { return; } - this._previousData[field] = oldValue; + if (Array.isArray(oldValue)) { + this._previousData[field] = []; + Object.assign(this._previousData[field], oldValue) + } + else { + this._previousData[field] = oldValue; + } } /**