fix: CommandView don't need to unmount itself

This commit is contained in:
hongarc 2020-03-30 10:25:49 +07:00
parent 9f2c599d82
commit 562843fa2e

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() {