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

Fix state sync issue before editor.html is available #227

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jhebb
Copy link
Contributor

@jhebb jhebb commented Feb 27, 2020

It's possible to miss a model update if the value changes before editor.html is available since Froala's internal state on this.oldModel will be updated with the new value, but not actually displayed visually because editor.html is not available.

I've tried to simulate a basic case here:
https://codesandbox.io/s/froala-react-h7jg6

I'm sure there's a more elegant way to resolve this, but this PR creates a new internal state flag for editor.html availability and triggers setContent even if the props match if the editor was not previously available but is now.

@kapil2704
Copy link
Contributor

@jhebb the link you have shared is not working https://codesandbox.io/s/froala-react-h7jg6 can you please explain the eroor in detail

@jhebb
Copy link
Contributor Author

jhebb commented Jul 2, 2020

The link works for me - it's just showing a number of simulated model updates in succession and showing that the same state value (num) set in a model update and rendered directly get out of sync.

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

Successfully merging this pull request may close these issues.

2 participants