@abraca/dabra 1.0.19 → 1.0.20
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/package.json
CHANGED
package/src/AbracadabraWS.ts
CHANGED
|
@@ -220,9 +220,8 @@ export class AbracadabraWS extends EventEmitter {
|
|
|
220
220
|
attach(provider: AbracadabraBaseProvider) {
|
|
221
221
|
const existing = this.configuration.providerMap.get(provider.configuration.name);
|
|
222
222
|
if (existing && existing !== provider) {
|
|
223
|
-
console.
|
|
224
|
-
`[AbracadabraWS] attach:
|
|
225
|
-
`This may indicate a duplicate loadChild for the same document.`
|
|
223
|
+
console.debug(
|
|
224
|
+
`[AbracadabraWS] attach: replacing provider for "${provider.configuration.name}".`
|
|
226
225
|
);
|
|
227
226
|
}
|
|
228
227
|
this.configuration.providerMap.set(provider.configuration.name, provider);
|
|
@@ -394,6 +394,25 @@ export class BackgroundSyncManager extends EventEmitter {
|
|
|
394
394
|
// Check if the provider already exists (user is viewing it) before loading.
|
|
395
395
|
const alreadyCached = this.rootProvider.children.has(docId);
|
|
396
396
|
|
|
397
|
+
// Another provider (e.g. a nested renderer) may have already loaded
|
|
398
|
+
// this doc through a different parent. The shared WS providerMap
|
|
399
|
+
// tracks all attached providers; if one exists, the doc is already
|
|
400
|
+
// syncing — skip to avoid creating a duplicate.
|
|
401
|
+
if (!alreadyCached) {
|
|
402
|
+
const wsProviderMap = (this.rootProvider as any).configuration
|
|
403
|
+
?.websocketProvider?.configuration?.providerMap as
|
|
404
|
+
| Map<string, unknown>
|
|
405
|
+
| undefined;
|
|
406
|
+
if (wsProviderMap?.has(docId)) {
|
|
407
|
+
return {
|
|
408
|
+
docId,
|
|
409
|
+
status: "synced",
|
|
410
|
+
lastSynced: Date.now(),
|
|
411
|
+
isE2E: false,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
397
416
|
const childProvider = await this.rootProvider.loadChild(docId);
|
|
398
417
|
|
|
399
418
|
// Wait for ready (offline snapshot loaded) then synced (server sync done)
|