perf: use lazy load provider for IDB and SQLITE (#3351)

This commit is contained in:
Peng Xiao
2023-07-26 00:56:48 +08:00
committed by GitHub
parent e3f66d7e22
commit 20ee9d485d
25 changed files with 481 additions and 758 deletions
@@ -45,7 +45,7 @@ const ImagePreviewModal = lazy(() =>
);
const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
const { onLoad, page, mode, style, onInit } = props;
const { onLoad, page, mode, style } = props;
if (!page.loaded) {
use(page.waitForLoaded());
}
@@ -66,14 +66,9 @@ const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
editor.mode = mode;
}
useEffect(() => {
if (editor.page !== page) {
editor.page = page;
if (page.root === null) {
onInit(page, editor);
}
}
}, [editor, page, onInit]);
if (editor.page !== page) {
editor.page = page;
}
useEffect(() => {
if (editor.page && onLoad) {