Composer: remove click listener on unmount

This commit is contained in:
Alex Gleason 2020-09-27 17:55:04 -05:00
parent 5ad39921f9
commit 136965acdd
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 4 additions and 0 deletions

View File

@ -182,6 +182,10 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
document.addEventListener('click', this.handleClick, true);
}
componentWillUnmount() {
document.removeEventListener('click', this.handleClick, true);
}
componentDidUpdate(prevProps, prevState) {
const { suggestions } = this.props;
if (suggestions !== prevProps.suggestions && suggestions.size > 0 && prevState.suggestionsHidden && prevState.focused) {