@shaxpir/duiduidui-models 1.4.20 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/repo/ShareSync.js +8 -0
- package/package.json +1 -1
package/dist/repo/ShareSync.js
CHANGED
|
@@ -260,6 +260,10 @@ class ShareSync {
|
|
|
260
260
|
}
|
|
261
261
|
async acquire(kind, id, timestamp) {
|
|
262
262
|
let model = this.load(kind, id);
|
|
263
|
+
if (!model) {
|
|
264
|
+
// Document doesn't exist or couldn't be loaded
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
263
267
|
if (timestamp) {
|
|
264
268
|
model = await model.acquire(timestamp);
|
|
265
269
|
}
|
|
@@ -315,6 +319,10 @@ class ShareSync {
|
|
|
315
319
|
// If not in the cache, get the model doc from the connection.
|
|
316
320
|
// Then wrap it and put it in the cache for future reference.
|
|
317
321
|
const doc = this._connection.get(kind, id);
|
|
322
|
+
if (!doc) {
|
|
323
|
+
console.error(`[ShareSync] connection.get(${kind}, ${id}) returned null/undefined doc`);
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
318
326
|
const model = this.wrap(kind, doc, false);
|
|
319
327
|
this._modelCache.set(compoundKey, model);
|
|
320
328
|
return model;
|