@abraca/dabra 1.8.0 → 1.8.2

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.
@@ -2438,12 +2438,13 @@ var AbracadabraBaseProvider = class extends EventEmitter {
2438
2438
  try {
2439
2439
  const parsed = JSON.parse(payload);
2440
2440
  if (parsed?.type === "error" && parsed.source && parsed.code) {
2441
- const { source, code, message } = parsed;
2442
- console.warn(`[Abracadabra] Server error: ${source} (${code}) — ${message}`);
2441
+ const { source, code, message, meta } = parsed;
2442
+ console.warn(`[Abracadabra] Server error: ${source} (${code}) — ${message}`, meta ?? "");
2443
2443
  this.emit("serverError", {
2444
2444
  source,
2445
2445
  code,
2446
- message: message ?? ""
2446
+ message: message ?? "",
2447
+ meta
2447
2448
  });
2448
2449
  return;
2449
2450
  }
@@ -2810,6 +2811,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2810
2811
  this.childAccessTimes = /* @__PURE__ */ new Map();
2811
2812
  this.pinnedChildren = /* @__PURE__ */ new Set();
2812
2813
  this.boundHandleYSubdocsChange = this.handleYSubdocsChange.bind(this);
2814
+ this.hasCachedContent = false;
2813
2815
  this._client = client;
2814
2816
  this.abracadabraConfig = configuration;
2815
2817
  this.subdocLoading = configuration.subdocLoading ?? "lazy";
@@ -2847,8 +2849,14 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2847
2849
  async _initFromOfflineStore() {
2848
2850
  if (!this.offlineStore) return;
2849
2851
  const [snapshot, pending] = await Promise.all([this.offlineStore.getDocSnapshot().catch(() => null), this.offlineStore.getPendingUpdates().catch(() => [])]);
2850
- if (snapshot) Y.applyUpdate(this.document, snapshot, this.offlineStore);
2851
- for (const update of pending) Y.applyUpdate(this.document, update, this.offlineStore);
2852
+ if (snapshot) {
2853
+ Y.applyUpdate(this.document, snapshot, this.offlineStore);
2854
+ this.hasCachedContent = true;
2855
+ }
2856
+ for (const update of pending) {
2857
+ Y.applyUpdate(this.document, update, this.offlineStore);
2858
+ this.hasCachedContent = true;
2859
+ }
2852
2860
  }
2853
2861
  authenticatedHandler(scope) {
2854
2862
  super.authenticatedHandler(scope);