From 58104c1a4cef4f17bee4c0161badf97f5d5cfaa3 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Thu, 23 May 2024 21:03:58 +0100 Subject: [PATCH] Fix broken files (#3821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes a bug that prevented files (which included an arrow) from opening correctly. ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `bugfix` — Bug fix ### Test Plan 1. Open a file that includes at least one arrow --- packages/tldraw/src/lib/utils/tldr/file.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/tldraw/src/lib/utils/tldr/file.ts b/packages/tldraw/src/lib/utils/tldr/file.ts index 6fe97ad38..456f53a2f 100644 --- a/packages/tldraw/src/lib/utils/tldr/file.ts +++ b/packages/tldraw/src/lib/utils/tldr/file.ts @@ -18,7 +18,6 @@ import { createTLStore, exhaustiveSwitchError, partition, - transact, } from '@tldraw/editor' import { TLUiToastsContextType } from '../../ui/context/toasts' import { TLUiTranslationKey } from '../../ui/hooks/useTranslation/TLUiTranslationKey' @@ -292,7 +291,7 @@ export async function parseAndLoadDocument( // just restore everything, so if the user has opened // this file before they'll get their camera etc. // restored. we could change this in the future. - transact(() => { + editor.store.atomic(() => { const initialBounds = editor.getViewportScreenBounds().clone() const isFocused = editor.getInstanceState().isFocused editor.store.clear()