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: use `startTransition` (#1903)

Himself656d5b101bb3e2
diff --git a/apps/web/src/components/page-detail-editor.tsx b/apps/web/src/components/page-detail-editor.tsx
index e5c3fdb324..72c335a16f 100644
--- a/apps/web/src/components/page-detail-editor.tsx
+++ b/apps/web/src/components/page-detail-editor.tsx
@@ -5,7 +5,7 @@ import { useBlockSuiteWorkspacePageTitle } from '@toeverything/hooks/use-blocksu
import { useAtomValue, useSetAtom } from 'jotai';
import Head from 'next/head';
import type React from 'react';
-import { lazy, useCallback } from 'react';
+import { lazy, startTransition, useCallback } from 'react';
import { currentEditorAtom, workspacePreferredModeAtom } from '../atoms';
import { usePageMeta } from '../hooks/use-page-meta';
@@ -73,14 +73,18 @@ export const PageDetailEditor: React.FC<PageDetailEditorProps> = ({
page={page}
onInit={useCallback(
(page: Page, editor: Readonly<EditorContainer>) => {
- setEditor(editor);
+ startTransition(() => {
+ setEditor(editor);
+ });
onInit(page, editor);
},
[onInit, setEditor]
)}
onLoad={useCallback(
(page: Page, editor: EditorContainer) => {
- setEditor(editor);
+ startTransition(() => {
+ setEditor(editor);
+ });
onLoad?.(page, editor);
},
[onLoad, setEditor]