@abraca/dabra 2.29.0 → 2.31.0

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.
@@ -3252,6 +3252,19 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
3252
3252
  return this.childProviders.has(childId);
3253
3253
  }
3254
3254
  /**
3255
+ * Whether a loaded child is currently transient — loaded with
3256
+ * `{ evictable: false }` (e.g. by a background indexer/sync) and not since
3257
+ * promoted to a normal UI-held child. A later `loadChild(id)` with the
3258
+ * default `evictable: true` clears this flag.
3259
+ *
3260
+ * Background loaders use this to decide whether they still own a child
3261
+ * before unloading it: if the UI opened the same doc mid-sync, the child is
3262
+ * no longer transient and must NOT be destroyed out from under the view.
3263
+ */
3264
+ isChildTransient(childId) {
3265
+ return this.transientChildren.has(childId);
3266
+ }
3267
+ /**
3255
3268
  * Create (or return cached) a child AbracadabraProvider for a given
3256
3269
  * child document id. Each child shares the parent's WebSocket via
3257
3270
  * multiplexing.
@@ -16431,7 +16444,7 @@ var BackgroundSyncManager = class extends EventEmitter {
16431
16444
  isE2E: false
16432
16445
  };
16433
16446
  }
16434
- const childProvider = await this.rootProvider.loadChild(docId);
16447
+ const childProvider = await this.rootProvider.loadChild(docId, { evictable: false });
16435
16448
  try {
16436
16449
  await childProvider.ready;
16437
16450
  await this._waitForSynced(childProvider);
@@ -16455,7 +16468,9 @@ var BackgroundSyncManager = class extends EventEmitter {
16455
16468
  isE2E: false
16456
16469
  };
16457
16470
  } finally {
16458
- if (!alreadyCached) this.rootProvider.unloadChild(docId);
16471
+ if (!alreadyCached) {
16472
+ if (typeof this.rootProvider.isChildTransient === "function" ? this.rootProvider.isChildTransient(docId) : true) this.rootProvider.unloadChild(docId);
16473
+ }
16459
16474
  }
16460
16475
  }
16461
16476
  async _syncE2EDoc(docId) {