From 66c3b09c670ea6dad8c6f014958755744136e7b9 Mon Sep 17 00:00:00 2001 From: Himself65 Date: Wed, 3 May 2023 22:55:45 -0500 Subject: [PATCH] fix(hooks): reduce unused `assertExists` (#2224) --- packages/hooks/src/use-block-suite-page-meta.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/hooks/src/use-block-suite-page-meta.ts b/packages/hooks/src/use-block-suite-page-meta.ts index cb7a21695a..a5fa6d58a8 100644 --- a/packages/hooks/src/use-block-suite-page-meta.ts +++ b/packages/hooks/src/use-block-suite-page-meta.ts @@ -45,7 +45,6 @@ export function usePageMetaHelper(blockSuiteWorkspace: Workspace) { return useMemo( () => ({ setPageTitle: (pageId: string, newTitle: string) => { - assertExists(blockSuiteWorkspace); const page = blockSuiteWorkspace.getPage(pageId); assertExists(page); const pageBlock = page @@ -56,19 +55,18 @@ export function usePageMetaHelper(blockSuiteWorkspace: Workspace) { pageBlock.title.delete(0, pageBlock.title.length); pageBlock.title.insert(newTitle, 0); }); - assertExists(blockSuiteWorkspace); blockSuiteWorkspace.meta.setPageMeta(pageId, { title: newTitle }); }, setPageMeta: (pageId: string, pageMeta: Partial) => { - assertExists(blockSuiteWorkspace); blockSuiteWorkspace.meta.setPageMeta(pageId, pageMeta); }, getPageMeta: (pageId: string) => { - assertExists(blockSuiteWorkspace); return blockSuiteWorkspace.meta.getPageMeta(pageId); }, + /** + * @deprecated + */ shiftPageMeta: (pageId: string, index: number) => { - assertExists(blockSuiteWorkspace); return blockSuiteWorkspace.meta.shiftPageMeta(pageId, index); }, }),