fix: add router defend

This commit is contained in:
QiShaoXuan
2022-12-22 18:35:51 +08:00
parent cc910dd9e9
commit a64f77c9d2
18 changed files with 284 additions and 120 deletions
@@ -9,7 +9,7 @@ export const useLoadWorkspace = () => {
const workspaceId = router.query.workspaceId as string;
useEffect(() => {
loadWorkspace?.current?.(workspaceId);
loadWorkspace?.(workspaceId);
}, [workspaceId, loadWorkspace]);
return currentWorkspaceId === workspaceId ? currentWorkspace : null;
@@ -29,7 +29,7 @@ export const useLoadPage = () => {
}
const page = pageId ? workspace?.getPage(pageId) : null;
if (page) {
loadPage?.current?.(pageId);
loadPage?.(pageId);
return;
}
@@ -39,7 +39,7 @@ export const useLoadPage = () => {
return;
}
createPage?.current?.()?.then(async pageId => {
createPage?.()?.then(async pageId => {
if (!pageId) {
return;
}