dispose editor controls on unmount

This commit is contained in:
casperlamboo 2017-11-06 14:40:19 +01:00
parent 1de8d84e36
commit 278a3a6c0a

View File

@ -34,6 +34,10 @@ class DoodlePreview extends React.Component {
this.editorControls.addEventListener('change', () => scene.render());
}
componentWillUnmount() {
if (this.editorControls) this.editorControls.dispose();
}
componentDidUpdate(prevProps) {
const { scene } = this.state;
const { width, height } = this.props;