-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Rename <Slate>
component value
prop to initialValue
#5421
Conversation
🦋 Changeset detectedLatest commit: ec5d95d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
value
prop to initialValue
<Slate>
component value
prop to initialValue
Looks good and makes sense to me. Going to leave it open for a couple of days in case anyone has other feedback. |
apologies for jumping into an already merged PR, but wouldn't this be a breaking change, as the API is changing? This is not explicitly highlighted anywhere, tbh. wdyt? |
What @atanasov-deyan says, just spent more time than I care to admit on trying to find out why stuff wasn't working. Turns out a minor change only visible in https://github.com/ianstormtaylor/slate/blob/main/packages/slate-react/CHANGELOG.md#0950 was the culprit, fixed with a oneliner 🙈 |
Description
The Slate editor is in fact an uncontrolled component, but the public API deceives into thinking it's a controlled input. This is because of the
value
andonChange
is a common React convention for controlled inputs, while uncontrolled inputs useinitialValue
instead.Issue
Fixes #4992
Example
Before:
After:
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)