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 NPE during reconciliation #6028

Merged
merged 3 commits into from
Feb 13, 2016

Conversation

sambev
Copy link

@sambev sambev commented Feb 12, 2016

ReactDOMSelect's _handleChange function tries to set
this._wrapperState.pendingUpdate = true after executing the onChange
function. However, if the select was removed as a result of said
fuction, this._wrapperState would be null. Resulting in an
Uncaught TypeError: Cannot set property 'pendingUpdate' of null.

#6027

ReactDOMSelect's _handleChange function tries to set
this._wrapperState.pendingUpdate = true after executing the onChange
function. However, if the select was removed as a result of said
fuction, this._wrapperState would be null. Resulting in an
Uncaught TypeError: Cannot set property 'pendingUpdate' of null.
@@ -236,7 +236,9 @@ function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);

this._wrapperState.pendingUpdate = true;
if (this._rootNodeID && !this._wrapperState.pendingUpdate) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me. We don't need to check the value of pendingUpdate, we can just blindly set it to true. Can you update the PR to remove that check?

We can just set it to true regardless.
@@ -236,7 +236,9 @@ function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);

this._wrapperState.pendingUpdate = true;
if (this._rootNodeID) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimfb Removed check for pendingUpdate. Let me know if there is anything else, or I misunderstood. Thanks!

@facebook-github-bot
Copy link

@sambev updated the pull request.

@jimfb
Copy link
Contributor

jimfb commented Feb 13, 2016

Looks good, thanks!

jimfb added a commit that referenced this pull request Feb 13, 2016
@jimfb jimfb merged commit 2410dc7 into facebook:master Feb 13, 2016
@jimfb jimfb changed the title Fix for issue/6027. Fix NPE during reconciliation Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants