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) { if (Object.keys(state).length) {
app.ready.then(() => { app.ready.then(() => {
if ('page' in state) { if ('page' in state) {
app.loadDocumentFromURL(state.page, state.pageState) app.loadPageFromURL(state.page, state.pageState)
} else { } else {
const nextDocument = state as TDDocument const nextDocument = state as TDDocument
if (nextDocument.id === app.document.id) { 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, // 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. // 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 * @param pageState
* @returns * @returns
*/ */
loadDocumentFromURL = (page: TDPage, pageState: Record<string, TLPageState>) => { loadPageFromURL = (page: TDPage, pageState: Record<string, TLPageState>) => {
const { currentPageId } = this
const pageId = page.id const pageId = page.id
const nextDocument = { const nextDocument = {
...this.state.document, ...this.state.document,