-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Conversation
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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!
@sambev updated the pull request. |
Looks good, thanks! |
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