refix the load document from URL
This commit is contained in:
parent
d6140aad8a
commit
26865a0a57
2 changed files with 9 additions and 4 deletions
|
@ -364,6 +364,8 @@ const InnerTldraw = React.memo(function InnerTldraw({
|
|||
}: InnerTldrawProps) {
|
||||
const app = useTldrawApp()
|
||||
const [dialogContainer, setDialogContainer] = React.useState<any>(null)
|
||||
|
||||
// In dev, we need to delete the prefixed
|
||||
const entry =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? window.location.hash.replace('#/develop/', '')
|
||||
|
@ -384,7 +386,7 @@ const InnerTldraw = React.memo(function InnerTldraw({
|
|||
}
|
||||
}
|
||||
}
|
||||
}, [decodedPage])
|
||||
}, [decodedPage, app])
|
||||
|
||||
const rWrapper = React.useRef<HTMLDivElement>(null)
|
||||
|
||||
|
|
|
@ -1400,10 +1400,11 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
|||
document?: TDDocument,
|
||||
page?: TDPage,
|
||||
pageState?: Record<string, TLPageState>
|
||||
): this => {
|
||||
) => {
|
||||
if (document) {
|
||||
this.loadDocument(document)
|
||||
return this
|
||||
this.zoomToFit()
|
||||
this.persist({})
|
||||
} else {
|
||||
this.setIsLoading(true)
|
||||
const { currentPageId } = this
|
||||
|
@ -1437,7 +1438,9 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
|||
},
|
||||
}
|
||||
this.setIsLoading(false)
|
||||
return this.setState(state)
|
||||
this.setState(state)
|
||||
this.zoomToFit()
|
||||
this.persist({})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue