@abraca/dabra 2.25.0 → 2.26.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.
@@ -15921,7 +15921,7 @@ function patchEntry(treeMap, id, patch, removeKeys = [], opts = {}) {
15921
15921
  //#region packages/provider/src/TreeTimestamps.ts
15922
15922
  /**
15923
15923
  * Attach an observer that writes `updatedAt` to the root doc-tree entry for
15924
- * `childDocId` whenever the child doc receives a non-offline update.
15924
+ * `childDocId` whenever the child doc receives a local edit.
15925
15925
  *
15926
15926
  * @param treeMap The root doc's "doc-tree" Y.Map.
15927
15927
  * @param childDocId The child document's UUID (key in treeMap).
@@ -15951,8 +15951,10 @@ function attachUpdatedAtObserver(treeMap, childDocId, childDoc, offlineStore, op
15951
15951
  pendingTs = 0;
15952
15952
  writeTs(ts);
15953
15953
  }
15954
- function handler(_update, origin) {
15955
- if (offlineStore !== null && origin === offlineStore) return;
15954
+ function handler(tr) {
15955
+ if (!tr.local) return;
15956
+ if (offlineStore !== null && tr.origin === offlineStore) return;
15957
+ if (tr.changed.size === 0) return;
15956
15958
  const now = Date.now();
15957
15959
  if (now - lastFlushedAt >= throttleMs) {
15958
15960
  writeTs(now);
@@ -15961,9 +15963,9 @@ function attachUpdatedAtObserver(treeMap, childDocId, childDoc, offlineStore, op
15961
15963
  pendingTs = now;
15962
15964
  if (timer === null) timer = setTimeout(flushPending, throttleMs - (now - lastFlushedAt));
15963
15965
  }
15964
- childDoc.on("update", handler);
15966
+ childDoc.on("afterTransaction", handler);
15965
15967
  return () => {
15966
- childDoc.off("update", handler);
15968
+ childDoc.off("afterTransaction", handler);
15967
15969
  if (timer !== null) {
15968
15970
  clearTimeout(timer);
15969
15971
  flushPending();