Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit e4edfeb

Browse files
dadamssgAidurber
authored andcommitted
fix(event listeners): remove event listeners on umount (#84)
fix leaving an invalid event listener if it is unmounted while the options are open
1 parent def2db6 commit e4edfeb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Picky.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ class Picky extends React.PureComponent {
4646
componentDidMount() {
4747
this.focusFilterInput(this.state.open);
4848
}
49-
49+
50+
componentWillUnmount() {
51+
document.removeEventListener('click', this.handleOutsideClick, false);
52+
}
53+
5054
UNSAFE_componentWillReceiveProps(nextProps) {
5155
if (
5256
this.props.options !== nextProps.options ||

0 commit comments

Comments
 (0)