🐛 fix(editor-canvas): re-check editor init state before subscribing (#15686)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Arvin Xu
2026-06-11 20:42:28 +08:00
committed by GitHub
parent 671bc26e0d
commit 813d756b9c
@@ -42,6 +42,14 @@ const useIsEditorInit = (editor?: IEditor) => {
useEffect(() => {
if (!editor) return;
// The editor may have initialized between render and this effect
// (the Editor canvas mounts earlier and emits 'initialized' synchronously),
// so re-check before subscribing to avoid missing the event forever.
if (editor.getLexicalEditor()) {
setEditInit(true);
return;
}
const onInit = () => {
setEditInit(true);
};