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

React component triggers onChange function when value-prop changes. This causes a bunch of annoying bugs. #84

Open
Discordius opened this issue Apr 13, 2021 · 1 comment
Assignees
Labels

Comments

@Discordius
Copy link

Discordius commented Apr 13, 2021

The current React implementation of the editor fires the onChange function when the value prop changes. This causes spurious rerenders and is in conflict with the standards of what I've seen basically any other editor library use.

This was causing a particularly gnarly bug in my use-case where I had a large data structure where the editor could be used to edit various different parts of it. When I pointed the editor at a different part of it (by changing its value and the passed onChange function) it would execute the onChange function of the previous render (together with the fieldName of the previous render), causing it to override the previous text in the datastructure with the text of the new part that was being navigated to. This of course was not the intended result and required some ugly hacks to work around.

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Mar 27, 2022
@pd4d10 pd4d10 self-assigned this Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants