Skip to content

Commit

Permalink
Fix memory leak in query_string_input (#77649)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik authored Sep 17, 2020
1 parent fc97a37 commit 102be1b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,16 @@ export class QueryStringInputUI extends Component<Props, State> {
this.updateSuggestions.cancel();
this.componentIsUnmounting = true;
window.removeEventListener('resize', this.handleAutoHeight);
window.removeEventListener('scroll', this.handleListUpdate);
window.removeEventListener('scroll', this.handleListUpdate, { capture: true });
}

handleListUpdate = () =>
this.setState({
handleListUpdate = () => {
if (this.componentIsUnmounting) return;

return this.setState({
queryBarRect: this.queryBarInputDivRefInstance.current?.getBoundingClientRect(),
});
};

handleAutoHeight = () => {
if (this.inputRef !== null && document.activeElement === this.inputRef) {
Expand Down

0 comments on commit 102be1b

Please sign in to comment.