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 updating "code" prop for Editor component #271

Merged
merged 3 commits into from
Jan 27, 2022
Merged

fix updating "code" prop for Editor component #271

merged 3 commits into from
Jan 27, 2022

Conversation

andgra
Copy link
Contributor

@andgra andgra commented Aug 23, 2021

The edited condition was never reachable because the default "state.prevCodeProp" is undefined and will never be updated because of this

@stevenocchipinti
Copy link

Pretty sure this fixes #279 and #281, I made this same change locally and it allowed me to use the code prop to control the state as I expected.

The documentation does state that the code prop doesn't include the users changes but I think it probably should as I couldn't find another way to dynamically change the state. Otherwise I'm guessing this probably should have followed the naming convention of defaultCode for uncontrolled props and code for controlled props (like defaultValue and value for <input>).

+1 for getting this merged in! If it does get merged, the docs might have to be updated too.

@jpdriver jpdriver linked an issue Jan 27, 2022 that may be closed by this pull request
@jpdriver
Copy link
Contributor

pushed a small update here that achieves the same thing since Editor has changed significantly since this PR was opened 🙇🏻‍♂️

@jpdriver jpdriver merged commit 2846aec into FormidableLabs:master Jan 27, 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

Successfully merging this pull request may close these issues.

Editor does not show up the dynamic code (BUG)
3 participants