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.

fix: first page default mode (#2719)

Himself6505b73a59bedc
diff --git a/apps/web/src/components/page-detail-editor.tsx b/apps/web/src/components/page-detail-editor.tsx
index f5e8427a71..1ad13dd84d 100644
--- a/apps/web/src/components/page-detail-editor.tsx
+++ b/apps/web/src/components/page-detail-editor.tsx
@@ -1,6 +1,9 @@
import './page-detail-editor.css';
-import { PageNotFoundError } from '@affine/env/constant';
+import {
+ DEFAULT_HELLO_WORLD_PAGE_ID,
+ PageNotFoundError,
+} from '@affine/env/constant';
import { rootCurrentEditorAtom } from '@affine/workspace/atom';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
@@ -61,7 +64,10 @@ const EditorWrapper = memo(function EditorWrapper({
meta => meta.id === pageId
);
const currentMode =
- useAtomValue(workspacePreferredModeAtom)[pageId] ?? 'page';
+ useAtomValue(workspacePreferredModeAtom)[pageId] ??
+ DEFAULT_HELLO_WORLD_PAGE_ID === pageId
+ ? 'edgeless'
+ : 'page';
const setEditor = useSetAtom(rootCurrentEditorAtom);
assertExists(meta);
return (
diff --git a/apps/web/src/layouts/workspace-layout.tsx b/apps/web/src/layouts/workspace-layout.tsx
index 946ff886ce..8e54fd4785 100644
--- a/apps/web/src/layouts/workspace-layout.tsx
+++ b/apps/web/src/layouts/workspace-layout.tsx
@@ -301,7 +301,7 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {
//#region init workspace
if (currentWorkspace.blockSuiteWorkspace.isEmpty) {
// this is a new workspace, so we should redirect to the new page
- const pageId = nanoid();
+ const pageId = DEFAULT_HELLO_WORLD_PAGE_ID;
const page = currentWorkspace.blockSuiteWorkspace.createPage({
id: pageId,
});