[fix] revert legacy changes to buildFromV1Document.ts (#1761)

This PR fixes some GREP-introduced errors to the old structure of legacy
v1 documents.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Open a V1 document.
This commit is contained in:
Steve Ruiz 2023-07-26 10:24:21 +01:00 committed by GitHub
parent d750da8f40
commit fd002d1797
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -780,12 +780,12 @@ function migrate(document: LegacyTldrawDocument, newVersion: number): LegacyTldr
// Cleanup // Cleanup
Object.values(document.pageStates).forEach((pageState) => { Object.values(document.pageStates).forEach((pageState) => {
pageState.selectedShapeIds = pageState.selectedShapeIds.filter((id) => { pageState.selectedIds = pageState.selectedIds.filter((id) => {
return document.pages[pageState.id].shapes[id] !== undefined return document.pages[pageState.id].shapes[id] !== undefined
}) })
pageState.bindingId = undefined pageState.bindingId = undefined
pageState.editingShapeId = undefined pageState.editingId = undefined
pageState.hoveredShapeId = undefined pageState.hoveredId = undefined
pageState.pointedId = undefined pageState.pointedId = undefined
}) })
@ -1027,15 +1027,15 @@ interface TLV1Bounds {
interface TLV1PageState { interface TLV1PageState {
id: string id: string
selectedShapeIds: string[] selectedIds: string[]
camera: { camera: {
point: number[] point: number[]
zoom: number zoom: number
} }
brush?: TLV1Bounds | null brush?: TLV1Bounds | null
pointedId?: string | null pointedId?: string | null
hoveredShapeId?: string | null hoveredId?: string | null
editingShapeId?: string | null editingId?: string | null
bindingId?: string | null bindingId?: string | null
} }