change function name, and useffect dep

This commit is contained in:
Judicael 2022-08-30 16:18:43 +03:00
parent 6079b3cb14
commit 4ec151ba4f
2 changed files with 3 additions and 4 deletions

View file

@ -241,7 +241,7 @@ export function Tldraw({
if (Object.keys(state).length) {
app.ready.then(() => {
if ('page' in state) {
app.loadDocumentFromURL(state.page, state.pageState)
app.loadPageFromURL(state.page, state.pageState)
} else {
const nextDocument = state as TDDocument
if (nextDocument.id === app.document.id) {
@ -252,7 +252,7 @@ export function Tldraw({
}
})
}
}, [app, decodedPage])
}, [app])
// Update the document if the `document` prop changes but the ids,
// are the same, or else load a new document if the ids are different.

View file

@ -1395,8 +1395,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
* @param pageState
* @returns
*/
loadDocumentFromURL = (page: TDPage, pageState: Record<string, TLPageState>) => {
const { currentPageId } = this
loadPageFromURL = (page: TDPage, pageState: Record<string, TLPageState>) => {
const pageId = page.id
const nextDocument = {
...this.state.document,