From 9a7cc86a75e920ab04ac017a122526d1542f74af Mon Sep 17 00:00:00 2001 From: CC Worker Date: Mon, 1 Jun 2026 06:16:07 +0000 Subject: [PATCH] =?UTF-8?q?fix(canvas):=20bypass=20localStoreService=20sin?= =?UTF-8?q?gleton=20=E2=80=94=20create=20store=20directly=20in=20effect=20?= =?UTF-8?q?to=20eliminate=20disposed-store=20reuse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/tldraw/singlePlayerPage.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/tldraw/singlePlayerPage.tsx b/src/pages/tldraw/singlePlayerPage.tsx index 647763d..304eb0c 100644 --- a/src/pages/tldraw/singlePlayerPage.tsx +++ b/src/pages/tldraw/singlePlayerPage.tsx @@ -6,7 +6,8 @@ import { useTldrawUser, DEFAULT_SUPPORT_VIDEO_TYPES, DEFAULT_SUPPORTED_IMAGE_TYPES, - TLStore + TLStore, + createTLStore, } from '@tldraw/tldraw'; import { useTLDraw } from '../../contexts/TLDrawContext'; import { useAuth } from '../../contexts/AuthContext'; @@ -93,10 +94,11 @@ export default function SinglePlayerPage() { const run = async () => { try { setCanvasPhase('store-init'); - const newStore = localStoreService.getStore({ + // Create a fresh store directly — bypassing singleton to avoid disposed-store reuse issues + const newStore = createTLStore({ schema: customSchema, shapeUtils: allShapeUtils, - bindingUtils: allBindingUtils + bindingUtils: allBindingUtils, }); const snapSvc = new NavigationSnapshotService(newStore, editorRef.current || undefined); @@ -154,7 +156,6 @@ export default function SinglePlayerPage() { snapshotServiceRef.current = null; storeRef.current?.dispose(); storeRef.current = null; - localStoreService.clearStore(); // reset singleton so next getStore() creates a fresh store setStoreReady(false); setCanvasPhase('idle'); };