mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 09:22:38 +03:00
fix(hooks): use uuid as pageId (#4658)
This commit is contained in:
parent
97d8660a54
commit
9958baa843
@ -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:*",
|
||||
|
@ -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 });
|
||||
},
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user