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.js CHANGED
@@ -2530,7 +2530,10 @@ function useRealtimeSession(options) {
2530
2530
  removeRealtimeOfflineDraft(roomId);
2531
2531
  return;
2532
2532
  }
2533
- writeRealtimeOfflineDraft(localDraftRef.current);
2533
+ const board = boardRef.current;
2534
+ const draft = localDraftRef.current;
2535
+ const draftToWrite = board && draft.yDocState == null ? { ...draft, yDocState: encodeYDocState(board) } : draft;
2536
+ writeRealtimeOfflineDraft(draftToWrite);
2534
2537
  }, [clearDraftPersistSchedule, roomId]);
2535
2538
  const scheduleDraftPersistence = useCallback(() => {
2536
2539
  clearDraftPersistSchedule();
@@ -2649,7 +2652,6 @@ function useRealtimeSession(options) {
2649
2652
  baseRevision,
2650
2653
  items: mergedItems,
2651
2654
  updatedAt: nowMs(),
2652
- yDocState: encodeYDocState(board),
2653
2655
  pendingIds: Array.from(pendingIds)
2654
2656
  });
2655
2657
  scheduleDraftPersistenceRef.current?.();
@@ -2757,7 +2759,6 @@ function useRealtimeSession(options) {
2757
2759
  baseRevision: serverDocument.revision,
2758
2760
  items: mergedItems,
2759
2761
  updatedAt: nowMs(),
2760
- yDocState: encodeYDocState(board),
2761
2762
  pendingIds: Array.from(pendingIds)
2762
2763
  });
2763
2764
  outboundInFlightRef.current = null;
@@ -3072,7 +3073,6 @@ function useRealtimeSession(options) {
3072
3073
  baseRevision: currentRevisionRef.current,
3073
3074
  items: mergedItems,
3074
3075
  updatedAt: nowMs(),
3075
- yDocState: board ? encodeYDocState(board) : void 0,
3076
3076
  pendingIds: board ? Array.from(getLocallyPendingItemIds(board)) : void 0
3077
3077
  });
3078
3078
  queuedDirtyRef.current = true;
@@ -3188,7 +3188,6 @@ function useRealtimeSession(options) {
3188
3188
  baseRevision: currentRevisionRef.current,
3189
3189
  items: mergedItems,
3190
3190
  updatedAt: nowMs(),
3191
- yDocState: encodeYDocState(board),
3192
3191
  pendingIds: Array.from(pendingIds)
3193
3192
  });
3194
3193
  }