change function name, and useffect dep
This commit is contained in:
parent
6079b3cb14
commit
4ec151ba4f
2 changed files with 3 additions and 4 deletions
|
@ -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.
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue