Skip to content
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

Model is not set in editor if it is updated during initialization #320

Open
cristianlivella opened this issue Mar 1, 2022 · 0 comments
Open

Comments

@cristianlivella
Copy link

cristianlivella commented Mar 1, 2022

Use context:

const [model, setModel] = useState(undefined);

return (
    <FroalaEditor
        model={model}
    />
)

If model is updated during the initialization, it is not set correctly in the editor, which remains empty.

In our case, we make a request to the API that starts at the same time as the editor renders. When the request is done, model is updated, but sometimes it happens that the editor remains empty.

A quick solution on our side would be to modify our component so that it doesn't render the editor until the API request is finished, but I think that's still an issue that should be checked here, because it doesn't seem like the right behavior.

You can find a proof of concept here (and the source code here).

cristianlivella added a commit to cristianlivella/react-froala-wysiwyg that referenced this issue Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant