fix: s13n
This commit is contained in:
parent
0042270f62
commit
b62f71bb3c
|
@ -27,7 +27,14 @@ export default (latus) => (Resource) => (
|
||||||
if (this._synchronized[type]?.[id]) {
|
if (this._synchronized[type]?.[id]) {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for (let i = 0; i < packet.data.packets.length; i++) {
|
for (let i = 0; i < packet.data.packets.length; i++) {
|
||||||
promises.push(this._synchronized[type][id].acceptPacket(packet.data.packets[i]));
|
const update = packet.data.packets[i];
|
||||||
|
promises.push(
|
||||||
|
Promise
|
||||||
|
.resolve(this._synchronized[type][id])
|
||||||
|
.then((resource) => {
|
||||||
|
resource.acceptPacket(update);
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
@ -52,10 +59,12 @@ export default (latus) => (Resource) => (
|
||||||
this._synchronized[type] = {};
|
this._synchronized[type] = {};
|
||||||
}
|
}
|
||||||
if (this._synchronized[type][id]) {
|
if (this._synchronized[type][id]) {
|
||||||
await this._synchronized[type][id].load(json);
|
await (await this._synchronized[type][id]).load(json);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this._serializer.create(`${type}:${id}`, Resource.load(json));
|
const later = Resource.load(json);
|
||||||
|
this._synchronized[type][id] = later;
|
||||||
|
this._serializer.create(`${type}:${id}`, later);
|
||||||
await this._serializer.later(`${type}:${id}`, (resource) => {
|
await this._serializer.later(`${type}:${id}`, (resource) => {
|
||||||
this._synchronized[type][id] = resource;
|
this._synchronized[type][id] = resource;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user