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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(hooks): use uuid as pageId (#4658)
Alex Yang9958baa843a7
diff --git a/packages/frontend/hooks/package.json b/packages/frontend/hooks/package.jsonindex 4bad2538da..e0867e1f35 100644--- a/packages/frontend/hooks/package.json+++ b/packages/frontend/hooks/package.json@@ -10,7 +10,8 @@"jotai": "^2.4.3","lodash.debounce": "^4.0.8","react": "18.2.0",- "swr": "2.2.4"+ "swr": "2.2.4",+ "uuid": "^9.0.1"},"devDependencies": {"@affine/env": "workspace:*",diff --git a/packages/frontend/hooks/src/use-block-suite-workspace-helper.ts b/packages/frontend/hooks/src/use-block-suite-workspace-helper.tsindex 3695884435..cbcd7a9a4e 100644--- a/packages/frontend/hooks/src/use-block-suite-workspace-helper.ts+++ b/packages/frontend/hooks/src/use-block-suite-workspace-helper.ts@@ -1,10 +1,14 @@import type { Page, Workspace } from '@blocksuite/store';import { useMemo } from 'react';+import { v4 as uuid } from 'uuid';export function useBlockSuiteWorkspaceHelper(blockSuiteWorkspace: Workspace) {return useMemo(() => ({createPage: (pageId?: string): Page => {+ if (!pageId) {+ pageId = uuid();+ }return blockSuiteWorkspace.createPage({ id: pageId });},}),diff --git a/yarn.lock b/yarn.lockindex 5dbeb14718..6f7510663c 100644--- a/yarn.lock+++ b/yarn.lock@@ -12706,6 +12706,7 @@ __metadata:lodash.debounce: ^4.0.8react: 18.2.0swr: 2.2.4+ uuid: ^9.0.1vitest: 0.34.6y-provider: "workspace:*"peerDependencies: