From 62afed445e00cb9811395f16d08266ddaafdd6cc Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 10 Nov 2025 18:01:36 -0800 Subject: [PATCH] final automerge errors on cloudflare --- src/automerge/useAutomergeSyncRepo.ts | 4 ++-- worker/AutomergeDurableObject.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/automerge/useAutomergeSyncRepo.ts b/src/automerge/useAutomergeSyncRepo.ts index f28eb28..e04c1a1 100644 --- a/src/automerge/useAutomergeSyncRepo.ts +++ b/src/automerge/useAutomergeSyncRepo.ts @@ -44,7 +44,7 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus // JSON sync is deprecated - all data now flows through Automerge sync protocol // Old format content is converted server-side and saved to R2 in Automerge format // This callback is kept for backwards compatibility but should not be used - const applyJsonSyncData = useCallback((data: TLStoreSnapshot) => { + const applyJsonSyncData = useCallback((_data: TLStoreSnapshot) => { console.warn('⚠️ JSON sync callback called but JSON sync is deprecated. All data should flow through Automerge sync protocol.') // Don't apply JSON sync - let Automerge sync handle everything return @@ -118,7 +118,7 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus // Continue anyway - user can still create new content } - const finalDoc = handle.doc() + const finalDoc = handle.doc() as any const finalStoreKeys = finalDoc?.store ? Object.keys(finalDoc.store).length : 0 const finalShapeCount = finalDoc?.store ? Object.values(finalDoc.store).filter((r: any) => r?.typeName === 'shape').length : 0 diff --git a/worker/AutomergeDurableObject.ts b/worker/AutomergeDurableObject.ts index fc5b3b6..e9d6ae9 100644 --- a/worker/AutomergeDurableObject.ts +++ b/worker/AutomergeDurableObject.ts @@ -1264,7 +1264,7 @@ export class AutomergeDurableObject { const docFromBucket = await this.r2.get(`rooms/${this.roomId}`) if (docFromBucket) { try { - const r2Doc = await docFromBucket.json() + const r2Doc = await docFromBucket.json() as any r2ShapeCount = r2Doc.store ? Object.values(r2Doc.store).filter((r: any) => r?.typeName === 'shape').length : 0