mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #5433 from spicyj/unmount-children-order
Unmount children before unsetting DOM node info
This commit is contained in:
@@ -1147,8 +1147,8 @@ ReactDOMComponent.Mixin = {
|
||||
break;
|
||||
}
|
||||
|
||||
ReactDOMComponentTree.uncacheNode(this);
|
||||
this.unmountChildren();
|
||||
ReactDOMComponentTree.uncacheNode(this);
|
||||
EventPluginHub.deleteAllListeners(this);
|
||||
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
||||
this._rootNodeID = null;
|
||||
|
||||
@@ -865,6 +865,22 @@ describe('ReactDOMComponent', function() {
|
||||
EventPluginHub.getListener(inst, 'onClick')
|
||||
).toBe(undefined);
|
||||
});
|
||||
|
||||
it('unmounts children before unsetting DOM node info', function() {
|
||||
var Inner = React.createClass({
|
||||
render: function() {
|
||||
return <span />;
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
// Should not throw
|
||||
expect(ReactDOM.findDOMNode(this).nodeName).toBe('SPAN');
|
||||
},
|
||||
});
|
||||
|
||||
var container = document.createElement('div');
|
||||
ReactDOM.render(<div><Inner /></div>, container);
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onScroll warning', function() {
|
||||
|
||||
Reference in New Issue
Block a user