Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

revert: page jump once

himself65de8af5f11495
diff --git a/apps/web/src/layouts/workspace-layout.tsx b/apps/web/src/layouts/workspace-layout.tsx
index 8523910146..0603d9450c 100644
--- a/apps/web/src/layouts/workspace-layout.tsx
+++ b/apps/web/src/layouts/workspace-layout.tsx
@@ -335,19 +335,30 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {
};
}, [currentWorkspace]);
- const page = currentWorkspace.blockSuiteWorkspace.getPage(
- DEFAULT_HELLO_WORLD_PAGE_ID
- );
- if (page && page.meta.jumpOnce) {
- currentWorkspace.blockSuiteWorkspace.meta.setPageMeta(
- DEFAULT_HELLO_WORLD_PAGE_ID,
- {
- jumpOnce: false,
- }
+ useEffect(() => {
+ if (!currentWorkspace) {
+ return;
+ }
+ const page = currentWorkspace.blockSuiteWorkspace.getPage(
+ DEFAULT_HELLO_WORLD_PAGE_ID
);
- setCurrentPageId(currentPageId);
- void jumpToPage(currentWorkspace.id, page.id);
- }
+ if (page && page.meta.jumpOnce) {
+ currentWorkspace.blockSuiteWorkspace.meta.setPageMeta(
+ DEFAULT_HELLO_WORLD_PAGE_ID,
+ {
+ jumpOnce: false,
+ }
+ );
+ setCurrentPageId(currentPageId);
+ void jumpToPage(currentWorkspace.id, page.id);
+ }
+ }, [
+ currentPageId,
+ currentWorkspace,
+ jumpToPage,
+ router.query.pageId,
+ setCurrentPageId,
+ ]);
const { openPage } = useRouterHelper(router);
const [, setOpenWorkspacesModal] = useAtom(openWorkspacesModalAtom);