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

View File

@@ -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) {

View File

@@ -11,7 +11,7 @@ import {
type TitleCellProps = {
icon: JSX.Element;
text: string;
desc?: string;
desc?: React.ReactNode;
suffix?: JSX.Element;
/**
* Customize the children of the cell

View File

@@ -15,7 +15,7 @@ export type ListData = {
pageId: string;
icon: JSX.Element;
title: string;
preview?: string;
preview?: React.ReactNode;
tags: Tag[];
favorite: boolean;
createDate: Date;
@@ -34,7 +34,7 @@ export type TrashListData = {
pageId: string;
icon: JSX.Element;
title: string;
preview?: string;
preview?: React.ReactNode;
createDate: Date;
// TODO remove optional after assert that trashDate is always set
trashDate?: Date;

View File

@@ -13,7 +13,7 @@ export type ContentProps = {
lineHeight?: CSSProperties['lineHeight'];
ellipsis?: boolean;
lineNum?: number;
children: string;
children: React.ReactNode;
};
export const Content = styled('div', {
shouldForwardProp: prop => {