mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
perf: use lazy load provider for IDB and SQLITE (#3351)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user