mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #6028 from sambev/issue/6027-uncaught-type-error
Fix for issue/6027.
This commit is contained in:
@@ -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 = true;
|
||||
}
|
||||
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -517,4 +517,24 @@ describe('ReactDOMSelect', function() {
|
||||
);
|
||||
expect(console.error.argsForCall.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should be able to safely remove select onChange', function() {
|
||||
function changeView() {
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
}
|
||||
|
||||
var container = document.createElement('div');
|
||||
var stub =
|
||||
<select value="giraffe" onChange={changeView}>
|
||||
<option value="monkey">A monkey!</option>
|
||||
<option value="giraffe">A giraffe!</option>
|
||||
<option value="gorilla">A gorilla!</option>
|
||||
</select>;
|
||||
stub = ReactDOM.render(stub, container);
|
||||
var node = ReactDOM.findDOMNode(stub);
|
||||
|
||||
expect(() => ReactTestUtils.Simulate.change(node)).not.toThrow(
|
||||
"Cannot set property 'pendingUpdate' of null"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user