commit 0154e44c2f1251b89fe03c3b431c35c91a70f81b
parent 293f7c6dd42a4f59328617e3c34011aa7b2a754b
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 16 Apr 2015 16:44:16 -0400
Mark all data as loaded when loading primary data for nonexistent object
Diffstat:
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js
@@ -47,9 +47,7 @@ Zotero.DataObject = function () {
this._identified = false;
this._loaded = {};
- for (let i=0; i<this._dataTypes.length; i++) {
- this._loaded[this._dataTypes[i]] = false;
- }
+ this._markAllDataTypeLoadStates(false);
this._clearChanged();
};
@@ -372,8 +370,11 @@ Zotero.DataObject.prototype.loadPrimaryData = Zotero.Promise.coroutine(function*
throw new Error(this._ObjectType + " " + (id ? id : libraryID + "/" + key)
+ " not found in Zotero." + this._ObjectType + ".loadPrimaryData()");
}
- this._loaded.primaryData = true;
this._clearChanged('primaryData');
+
+ // If object doesn't exist, mark all data types as loaded
+ this._markAllDataTypeLoadStates(true);
+
return;
}
@@ -457,6 +458,12 @@ Zotero.DataObject.prototype.loadAllData = function (reload) {
return Zotero.Promise.all(loadPromises);
}
+Zotero.DataObject.prototype._markAllDataTypeLoadStates = function (loaded) {
+ for (let i = 0; i < this._dataTypes.length; i++) {
+ this._loaded[this._dataTypes[i]] = loaded;
+ }
+}
+
/**
* Save old version of data that's being changed, to pass to the notifier
* @param {String} field