commit b59fa1eed9e4403c9d92d5aef0c1887bded8aea5 parent 5fc524bcb2a3e48b2786642040758969e77c30de Author: Dan Stillman <dstillman@zotero.org> Date: Mon, 1 Jun 2015 19:58:01 -0400 Store copy of changed object in _markFieldChange() Otherwise a splice() on a stored array affects the calculation of what's new. Diffstat:
| M | 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 @@ -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; + } } /**