From 834cd704b0cde99fd112411c5e5ca8dbb9d8bc49 Mon Sep 17 00:00:00 2001 From: Amir Angel <36531255+17Amir17@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:38:39 +0200 Subject: [PATCH] fix: editor not ready warning --- src/RichText/useEditorBridge.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RichText/useEditorBridge.tsx b/src/RichText/useEditorBridge.tsx index 77262ae..82c5321 100644 --- a/src/RichText/useEditorBridge.tsx +++ b/src/RichText/useEditorBridge.tsx @@ -57,12 +57,13 @@ export const useEditorBridge = (options?: { const editable = options?.editable === undefined ? true : options.editable; useEffect(() => { + if (!webviewRef.current) return; if (options) { // Special case for editable prop, since its command is on the core bridge and we want to access it via useEditorBridge editorInstance?.setEditable(editable); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [editable]); + }, [editable, webviewRef.current]); const _updateEditorState = (editorState: BridgeState) => { editorStateRef.current = editorState;