canvu-react 0.4.1 → 0.4.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.
package/dist/realtime.cjs CHANGED
@@ -2555,7 +2555,10 @@ function useRealtimeSession(options) {
2555
2555
  removeRealtimeOfflineDraft(roomId);
2556
2556
  return;
2557
2557
  }
2558
- writeRealtimeOfflineDraft(localDraftRef.current);
2558
+ const board = boardRef.current;
2559
+ const draft = localDraftRef.current;
2560
+ const draftToWrite = board && draft.yDocState == null ? { ...draft, yDocState: encodeYDocState(board) } : draft;
2561
+ writeRealtimeOfflineDraft(draftToWrite);
2559
2562
  }, [clearDraftPersistSchedule, roomId]);
2560
2563
  const scheduleDraftPersistence = react.useCallback(() => {
2561
2564
  clearDraftPersistSchedule();
@@ -2674,7 +2677,6 @@ function useRealtimeSession(options) {
2674
2677
  baseRevision,
2675
2678
  items: mergedItems,
2676
2679
  updatedAt: nowMs(),
2677
- yDocState: encodeYDocState(board),
2678
2680
  pendingIds: Array.from(pendingIds)
2679
2681
  });
2680
2682
  scheduleDraftPersistenceRef.current?.();
@@ -2782,7 +2784,6 @@ function useRealtimeSession(options) {
2782
2784
  baseRevision: serverDocument.revision,
2783
2785
  items: mergedItems,
2784
2786
  updatedAt: nowMs(),
2785
- yDocState: encodeYDocState(board),
2786
2787
  pendingIds: Array.from(pendingIds)
2787
2788
  });
2788
2789
  outboundInFlightRef.current = null;
@@ -3097,7 +3098,6 @@ function useRealtimeSession(options) {
3097
3098
  baseRevision: currentRevisionRef.current,
3098
3099
  items: mergedItems,
3099
3100
  updatedAt: nowMs(),
3100
- yDocState: board ? encodeYDocState(board) : void 0,
3101
3101
  pendingIds: board ? Array.from(getLocallyPendingItemIds(board)) : void 0
3102
3102
  });
3103
3103
  queuedDirtyRef.current = true;
@@ -3213,7 +3213,6 @@ function useRealtimeSession(options) {
3213
3213
  baseRevision: currentRevisionRef.current,
3214
3214
  items: mergedItems,
3215
3215
  updatedAt: nowMs(),
3216
- yDocState: encodeYDocState(board),
3217
3216
  pendingIds: Array.from(pendingIds)
3218
3217
  });
3219
3218
  }