Mark all data as loaded when loading primary data for nonexistent object

This commit is contained in:
Dan Stillman 2015-04-16 16:44:16 -04:00
parent 293f7c6dd4
commit 0154e44c2f

View File

@ -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