From 64d4a656130c0d764f352e3b704d3e5659dc428d Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sun, 16 Nov 2025 05:00:04 -0700 Subject: [PATCH] fix: await repo.find() to fix TypeScript build errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit repo.find() returns a Promise, so we need to await it. This fixes the TypeScript compilation errors in the build. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/automerge/useAutomergeSyncRepo.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/automerge/useAutomergeSyncRepo.ts b/src/automerge/useAutomergeSyncRepo.ts index 6ffb9d9..92feb39 100644 --- a/src/automerge/useAutomergeSyncRepo.ts +++ b/src/automerge/useAutomergeSyncRepo.ts @@ -119,19 +119,20 @@ export function useAutomergeSync(config: AutomergeSyncConfig): TLStoreWithStatus // CRITICAL: Use repo.find() with a consistent document ID based on roomId // This ensures all windows/tabs share the same Automerge document and can sync properly // Format: automerge:${roomId} matches what the server expects (see AutomergeDurableObject.ts line 327) - const documentId = `automerge:${roomId}` + const documentId = `automerge:${roomId}` as any console.log(`🔌 Finding or creating Automerge document with ID: ${documentId}`) - + // Use repo.find() to get or create the document with this ID // This ensures all windows share the same document instance - const handle = repo.find(documentId) - + // Note: repo.find() returns a Promise, so we await it + const handle = await repo.find(documentId) + console.log("Found/Created Automerge handle via Repo:", { handleId: handle.documentId, isReady: handle.isReady(), roomId: roomId }) - + // Wait for the handle to be ready await handle.whenReady()