-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Editor isn't ready yet and setting content not working #175
Comments
Hey @mbpictures the issue here is that it takes some time for the editor to initialize and accept messages, that warning is thrown because a message was sent before the editor can do anything about it. You can know the editor is ready from the editor state, try update your code to useEffect(() => {
if (!content || !isVisible || !editor.getEditorState().isReady) {
return;
}
editor.setContent(content);
}, [content, isVisible]); Of course this will not call setContent if it is not ready yet, but the initial content should be loaded from the prop anyways, alternatively you could list for isReady updates with useBridgeState |
Thanks for this hint! Even when I update my code like this, I'm getting the same warning: const editor = useEditorBridge({
initialContent: content
});
const editorState = useBridgeState(editor);
useEffect(() => {
if (!content || !isVisible || !editorState.isReady) {
return;
}
editor.setContent(content);
}, [isVisible, editorState.isReady]); |
I also have this error |
Update: even without setting the content at all I get the warning |
I'm unable to reproduce this, could you share a clean repo where this happens so I can investigate? |
I'm creating |
EDIT: sorry this is not related, the best way to go forward would be to provide me with a repo that reproduces it |
I'm using a bare react native project, with one expo-module integrated (expo-av) |
I realized that the editor needs an input to be rendered together. |
I have encountered the same issue. Could you please share your code? Thank you very much. |
Describe the bug
I'm using the
useEditorBridge()
hook inside a modal component and on the mount of the component, I'm getting an "Editor isn't ready yet" warning.To Reproduce
This is my modal component:
Expected behavior
Content is updating once the useEffect hook triggers the setContent method. No warnings.
Screenshots
The text was updated successfully, but these errors were encountered: