Merge pull request #670 from Hongarc/fix/unmount

fix: `CommandView` don't need to unmount itself
This commit is contained in:
Peter Cottle 2020-03-30 08:12:30 -07:00 committed by GitHub
commit 67664cc2c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,17 +15,11 @@ class CommandView extends React.Component{
componentDidMount() {
this.props.command.on('change', this.updateStateFromModel, this);
this.props.command.on('destroy', this.onModelDestroy, this);
this.updateStateFromModel();
}
componentWillUnmount() {
this.props.command.off('change', this.updateStateFromModel, this);
this.props.command.off('destroy', this.onModelDestroy, this);
}
onModelDestroy() {
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this).parentNode);
}
updateStateFromModel() {