mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 10:52:40 +08:00
fix: unexpected jump 404 page (#3190)
This commit is contained in:
@@ -214,31 +214,6 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region check if page is valid
|
||||
useEffect(() => {
|
||||
if (
|
||||
typeof router.query.pageId === 'string' &&
|
||||
router.pathname === '/workspace/[workspaceId]/[pageId]' &&
|
||||
currentPageId
|
||||
) {
|
||||
if (currentPageId !== router.query.pageId) {
|
||||
setCurrentPageId(router.query.pageId);
|
||||
} else {
|
||||
const page =
|
||||
currentWorkspace.blockSuiteWorkspace.getPage(currentPageId);
|
||||
if (!page) {
|
||||
router.push('/404').catch(console.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [
|
||||
currentPageId,
|
||||
currentWorkspace.blockSuiteWorkspace,
|
||||
router,
|
||||
setCurrentPageId,
|
||||
]);
|
||||
//#endregion
|
||||
|
||||
usePassiveWorkspaceEffect(currentWorkspace.blockSuiteWorkspace);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user