@abraca/dabra 1.3.2 → 1.3.4
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
|
@@ -540,6 +540,9 @@ export class AbracadabraProvider extends AbracadabraBaseProvider {
|
|
|
540
540
|
// Persist locally first (fire-and-forget; errors are non-fatal).
|
|
541
541
|
this.offlineStore?.persistUpdate(update).catch(() => null);
|
|
542
542
|
|
|
543
|
+
// Don't send writes over the wire if we lack write permission.
|
|
544
|
+
if (!this.canWrite) return;
|
|
545
|
+
|
|
543
546
|
super.documentUpdateHandler(update, origin);
|
|
544
547
|
}
|
|
545
548
|
|
|
@@ -554,6 +557,7 @@ export class AbracadabraProvider extends AbracadabraBaseProvider {
|
|
|
554
557
|
* errors across async await boundaries.
|
|
555
558
|
*/
|
|
556
559
|
private async flushPendingUpdates() {
|
|
560
|
+
if (!this.canWrite) return;
|
|
557
561
|
const store = this.offlineStore;
|
|
558
562
|
if (!store) return;
|
|
559
563
|
|
package/src/TreeTimestamps.ts
CHANGED
|
@@ -40,9 +40,12 @@ export function attachUpdatedAtObserver(
|
|
|
40
40
|
if (offlineStore !== null && origin === offlineStore) return;
|
|
41
41
|
|
|
42
42
|
// Update the root tree entry (no-op if the entry doesn't exist).
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
43
|
+
const raw = treeMap.get(childDocId);
|
|
44
|
+
if (!raw) return;
|
|
45
45
|
|
|
46
|
+
// Guard: if the entry is a nested Y.Map (possible after Yrs
|
|
47
|
+
// document compaction), convert to plain object so spread works.
|
|
48
|
+
const entry = raw instanceof Y.Map ? (raw as any).toJSON() : raw;
|
|
46
49
|
treeMap.set(childDocId, { ...entry, updatedAt: Date.now() });
|
|
47
50
|
}
|
|
48
51
|
|