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.

chore: add null check for create new page with title (#1490)

JimmFlyfd6abfa8ce81
diff --git a/apps/web/src/components/pure/quick-search-modal/Footer.tsx b/apps/web/src/components/pure/quick-search-modal/Footer.tsx
index 1887b8212b..9a3e75b4e6 100644
--- a/apps/web/src/components/pure/quick-search-modal/Footer.tsx
+++ b/apps/web/src/components/pure/quick-search-modal/Footer.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from '@affine/i18n';
import type { PageBlockModel } from '@blocksuite/blocks';
import { PlusIcon } from '@blocksuite/icons';
-import { assertEquals, nanoid } from '@blocksuite/store';
+import { assertEquals, assertExists, nanoid } from '@blocksuite/store';
import { Command } from 'cmdk';
import { NextRouter } from 'next/router';
import React from 'react';
@@ -44,6 +44,7 @@ export const Footer: React.FC<FooterProps> = ({
const block = newPage.getBlockByFlavour(
'affine:page'
)[0] as PageBlockModel;
+ assertExists(block);
block.title.insert(query, 0);
}
}}