From 5fd83944fc954656ed7a173fe7c2765c0218407e Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 11 Nov 2025 01:08:55 -0800 Subject: [PATCH] coordinate fix --- src/routes/Board.tsx | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/routes/Board.tsx b/src/routes/Board.tsx index be176a3..9e8b62d 100644 --- a/src/routes/Board.tsx +++ b/src/routes/Board.tsx @@ -493,24 +493,19 @@ export function Board() { } } - // Initial check after a short delay to ensure editor is ready - setTimeout(checkAndFixMissingShapes, 500) + // REMOVED: Recurring checks that were causing coordinate resets + // Only do initial check once after shapes are loaded + // The recurring checks were triggering store.put operations that caused + // coordinates to reset when patches came back from Automerge - // Also check after shapes are loaded (give more time for initial load) - setTimeout(checkAndFixMissingShapes, 2000) - setTimeout(checkAndFixMissingShapes, 5000) - - // Listen to store changes to continuously monitor for missing shapes - // Listen to ALL sources (user, remote, etc.) to catch shapes loaded from Automerge - let checkTimeout: NodeJS.Timeout | null = null - const unsubscribe = store.store.listen(() => { - // Use consistent debounce for both dev and prod - if (checkTimeout) clearTimeout(checkTimeout) - checkTimeout = setTimeout(checkAndFixMissingShapes, 500) - }) + // Single check after shapes are loaded (give time for initial load) + // This is the only time we'll fix missing shapes - no recurring checks + const initialCheckTimeout = setTimeout(() => { + checkAndFixMissingShapes() + }, 3000) // Wait 3 seconds for initial load to complete return () => { - unsubscribe() + clearTimeout(initialCheckTimeout) } }, [editor, store.store, store.status])