mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
fix: cannot update a component while rendering a different component (#1907)
This commit is contained in:
@@ -41,13 +41,17 @@ const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
|
|||||||
if (editor.mode !== props.mode) {
|
if (editor.mode !== props.mode) {
|
||||||
editor.mode = props.mode;
|
editor.mode = props.mode;
|
||||||
}
|
}
|
||||||
if (editor.page !== props.page) {
|
|
||||||
editor.page = props.page;
|
useEffect(() => {
|
||||||
if (page.root === null) {
|
if (editor.page !== props.page) {
|
||||||
props.onInit(page, editor);
|
editor.page = props.page;
|
||||||
|
if (page.root === null) {
|
||||||
|
props.onInit(page, editor);
|
||||||
|
}
|
||||||
|
props.onLoad?.(page, editor);
|
||||||
}
|
}
|
||||||
props.onLoad?.(page, editor);
|
}, [props.page, props.onInit, props.onLoad]);
|
||||||
}
|
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user