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

Gives a warning when visiting editor.value during onChange #2165

Closed
wants to merge 2 commits into from

Conversation

zhujinxuan
Copy link
Contributor

Is this adding or improving a feature or fixing a bug?

perhaps a bug; Editor run into a runaway recursion when visiting editor.value during onChange
#2152

What's the new behavior?

  1. Allows user visit editor.value during onChange.
  2. Gives a warning when user do it.

How does this change work?

Adds tmp.isResolvingValue in editor

Have you checked that...?

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn prettier.)
  • The relevant examples still work. (Run examples with yarn watch.)

Does this fix any issues or need any specific reviewers?

Fixes: #2152
Reviewers: @ericedem

@ericedem
Copy link
Contributor

I'm not sure I understand. Is the API user supposed to be only calling editor.props.value? How could the user know that there is a change being resolved in order to call the right one?

It seems like the user shouldn't be calling editor.value at all?

@zhujinxuan
Copy link
Contributor Author

zhujinxuan commented Sep 10, 2018

@ericedem You can call editor.value with onEvent like onKeyDown, but not with onChange

@ianstormtaylor Shall we break onChange with onNormalization and onChange? It seems a bit confusing with the name onChange which appears like onEvent. But it is perhaps unwise to access editor.XXX during onChange

@ericedem
Copy link
Contributor

@zhujinxuan What benefit is there to calling editor.value in an event handler as opposed to editor.props.value? Isn't the value guaranteed to be normalized in handlers (except onChange)?

@zhujinxuan
Copy link
Contributor Author

zhujinxuan commented Sep 11, 2018 via email

@zhujinxuan zhujinxuan closed this Sep 19, 2018
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.

Runaway recursion when trying to access editor.value in a plugin onChange event
2 participants