Skip to content

Commit

Permalink
Merge pull request #129 from vnma0/lifecycle-cover
Browse files Browse the repository at this point in the history
Covering lifecycle event to prevent memory leak
  • Loading branch information
minhducsun2002 committed Apr 17, 2019
2 parents d2fbecf + 9759493 commit 3ca66ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/problemList/codeEditor/codeBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class CodeBox extends React.PureComponent {
this.updateEditorHeight();
window.addEventListener("resize", this.updateEditorHeight);
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateEditorHeight);
}

//update editor height when resize window
updateEditorHeight() {
this.setState({
Expand Down

0 comments on commit 3ca66ae

Please sign in to comment.