You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slate was recently changed to be an uncontrolled component. this leads to massive problems for integrators of slate as uncontrolled components are not predictable because they have an inner state that is not fully controllable from outside.
Uncontrolled components therefore lead to bugs and inconsistencies
Solution
Slate should be a controlled component, means that it will always show consistently what is passed as a value
Alternatives
a workaround is shown here #4992 but that also does not always work. Since it relies on a useEffect the execution of the effect might be delayed and things get out of sync.
Context
I am maintaining https://github.com/react-page/react-page and we use slate for rich-text editing. Since the mentioned update we have a hard time to fix all inconsistencies regarding slate
The text was updated successfully, but these errors were encountered:
Uncontrolled component itself its fine, the problem is that the person with knowledge who made those breaking changes, failed to include the uncontrolled doc for those changes, and neglect the controlled behavior in React. It starts to turn out to be a mess now.
One thing I am pretty sure is that if you are using useEffect to update the state without waiting something externally from outside of the app (like waiting for an api call and then update the internal data). You might be doing something wrong most of the times.
I believe the "intended" way based on the PR is to directly call those Transforms.XXX, Editor.apply, etc. to do the state(editor value) manipulation. You have to simplify, wrap those inner functions and expose to the users if you want to let user control the value since slate-react currently failed to provide some shortcut helper functions for this part.
Problem
Slate was recently changed to be an uncontrolled component. this leads to massive problems for integrators of slate as uncontrolled components are not predictable because they have an inner state that is not fully controllable from outside.
Uncontrolled components therefore lead to bugs and inconsistencies
Solution
Slate should be a controlled component, means that it will always show consistently what is passed as a value
Alternatives
a workaround is shown here #4992 but that also does not always work. Since it relies on a
useEffect
the execution of the effect might be delayed and things get out of sync.Context
I am maintaining https://github.com/react-page/react-page and we use slate for rich-text editing. Since the mentioned update we have a hard time to fix all inconsistencies regarding slate
The text was updated successfully, but these errors were encountered: