@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.
@@ -2468,12 +2468,13 @@ var AbracadabraBaseProvider = class extends EventEmitter {
2468
2468
  try {
2469
2469
  const parsed = JSON.parse(payload);
2470
2470
  if (parsed?.type === "error" && parsed.source && parsed.code) {
2471
- const { source, code, message } = parsed;
2472
- console.warn(`[Abracadabra] Server error: ${source} (${code}) — ${message}`);
2471
+ const { source, code, message, meta } = parsed;
2472
+ console.warn(`[Abracadabra] Server error: ${source} (${code}) — ${message}`, meta ?? "");
2473
2473
  this.emit("serverError", {
2474
2474
  source,
2475
2475
  code,
2476
- message: message ?? ""
2476
+ message: message ?? "",
2477
+ meta
2477
2478
  });
2478
2479
  return;
2479
2480
  }
@@ -2840,6 +2841,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2840
2841
  this.childAccessTimes = /* @__PURE__ */ new Map();
2841
2842
  this.pinnedChildren = /* @__PURE__ */ new Set();
2842
2843
  this.boundHandleYSubdocsChange = this.handleYSubdocsChange.bind(this);
2844
+ this.hasCachedContent = false;
2843
2845
  this._client = client;
2844
2846
  this.abracadabraConfig = configuration;
2845
2847
  this.subdocLoading = configuration.subdocLoading ?? "lazy";
@@ -2877,8 +2879,14 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2877
2879
  async _initFromOfflineStore() {
2878
2880
  if (!this.offlineStore) return;
2879
2881
  const [snapshot, pending] = await Promise.all([this.offlineStore.getDocSnapshot().catch(() => null), this.offlineStore.getPendingUpdates().catch(() => [])]);
2880
- if (snapshot) yjs.applyUpdate(this.document, snapshot, this.offlineStore);
2881
- for (const update of pending) yjs.applyUpdate(this.document, update, this.offlineStore);
2882
+ if (snapshot) {
2883
+ yjs.applyUpdate(this.document, snapshot, this.offlineStore);
2884
+ this.hasCachedContent = true;
2885
+ }
2886
+ for (const update of pending) {
2887
+ yjs.applyUpdate(this.document, update, this.offlineStore);
2888
+ this.hasCachedContent = true;
2889
+ }
2882
2890
  }
2883
2891
  authenticatedHandler(scope) {
2884
2892
  super.authenticatedHandler(scope);