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

Fixed a bug in CodeMirror component lifecycle #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jbeard4
Copy link

@jbeard4 jbeard4 commented Feb 15, 2018

What I expect to happen:

  • first componentWillUpdate is called, such that old and new props are different
  • then render() is called with the new props, if componentShouldUpdate is true.

What actually happens:

  • first render() is called with the new props.
  • then componentWillUpdate is called such that old and new props are the same.

This is because debounce is deferring execution of
componentWillReceiveProps, thus breaking react component lifecycle
(which is described here:
https://busypeoples.github.io/post/react-component-lifecycle/).

What I expect to happen:
* first componentWillUpdate is called, such that old and new props are
* different
* then render() is called with the new props, if componentShouldUpdate
* is true.

What actually happens:

* first render() is called with the new props.
* then componentWillUpdate is called such that old and new props are the
* same.

This is because debounce is deferring execution of
componentWillReceiveProps, thus breaking react component lifecycle
(which is described here:
https://busypeoples.github.io/post/react-component-lifecycle/).
@scniro
Copy link

scniro commented Feb 18, 2018

@jbeard4 This library is pretty much abandoned. Have you've glimpsed at the plethora of issues? I wrote react-codemirror2 and have been actively maintaining it because of the frustrations I've encountered here. Not to mention the lack of tests, heavy dependencies, ancient documentation, etc. I am shocked people are still grasping on to this library...

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.

2 participants