fix(canvas): bypass localStoreService singleton — create store directly in effect to eliminate disposed-store reuse
Some checks failed
app-ci-deploy / test-build-deploy (push) Has been cancelled
Some checks failed
app-ci-deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
parent
6cba932146
commit
9a7cc86a75
@ -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');
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user