Fix weird test failure after c5cd38b4a5
The change in c5cd38b4a5
seems like it shouldn't have had any effect,
but creating an empty Set before yielding somehow avoided a race
condition with the subsequent updateSession call.
This commit is contained in:
parent
c5cd38b4a5
commit
52c1249523
|
@ -164,17 +164,17 @@ Zotero.Server.Connector.SaveSession.prototype.update = async function (libraryID
|
||||||
};
|
};
|
||||||
|
|
||||||
Zotero.Server.Connector.SaveSession.prototype._addObjects = async function (objectType, objects) {
|
Zotero.Server.Connector.SaveSession.prototype._addObjects = async function (objectType, objects) {
|
||||||
// Update the objects with the current target data, in case it changed since the save began
|
|
||||||
await this._updateObjects({
|
|
||||||
[objectType]: objects
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!this._objects[objectType]) {
|
if (!this._objects[objectType]) {
|
||||||
this._objects[objectType] = new Set();
|
this._objects[objectType] = new Set();
|
||||||
}
|
}
|
||||||
for (let object of objects) {
|
for (let object of objects) {
|
||||||
this._objects[objectType].add(object);
|
this._objects[objectType].add(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the objects with the current target data, in case it changed since the save began
|
||||||
|
await this._updateObjects({
|
||||||
|
[objectType]: objects
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user