Allow data to be set after save() on a new object without load() calls
After saving a new object and reloading primary data and any changed data (which we can maybe reconsider at some point), mark all other data types as loaded, since there's no other data we don't have. For example, this allows for item.save() to be followed by item.setField() without needing to call item.loadItemData() first.
This commit is contained in:
parent
5d530e4173
commit
3d3b817724
3 changed files with 12 additions and 0 deletions
|
@ -321,6 +321,10 @@ Zotero.Collection.prototype._finalizeSave = Zotero.Promise.coroutine(function* (
|
|||
|
||||
if (!env.skipCache) {
|
||||
yield this.reload();
|
||||
// If new, there's no other data we don't have, so we can mark everything as loaded
|
||||
if (env.isNew) {
|
||||
this._markAllDataTypeLoadStates(true);
|
||||
}
|
||||
this._clearChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -1736,6 +1736,10 @@ Zotero.Item.prototype._finalizeSave = Zotero.Promise.coroutine(function* (env) {
|
|||
// and not primaryData.
|
||||
yield this.loadPrimaryData(true);
|
||||
yield this.reload();
|
||||
// If new, there's no other data we don't have, so we can mark everything as loaded
|
||||
if (env.isNew) {
|
||||
this._markAllDataTypeLoadStates(true);
|
||||
}
|
||||
this._clearChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,10 @@ Zotero.Search.prototype._finalizeSave = Zotero.Promise.coroutine(function* (env)
|
|||
if (!env.skipCache) {
|
||||
yield this.loadPrimaryData(true);
|
||||
yield this.reload();
|
||||
// If new, there's no other data we don't have, so we can mark everything as loaded
|
||||
if (env.isNew) {
|
||||
this._markAllDataTypeLoadStates(true);
|
||||
}
|
||||
this._clearChanged();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue