Fix broken files (#3821)

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
This commit is contained in:
Steve Ruiz 2024-05-23 21:03:58 +01:00 committed by GitHub
parent 87e3d60c90
commit 58104c1a4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()