Skip to content

Commit

Permalink
fix: Unregister event listener for simpleSelect (#88) 🐛
Browse files Browse the repository at this point in the history
When using simpleSelect, and having multiple instances of the component on the same page, opening
dropdown content after selecting something in another dropdwon causes the previous dropdown to open
as well. This happens since  andleOutsideClick is still listening for changes on the previous
instance.
  • Loading branch information
mrchief authored Apr 11, 2018
1 parent 334f8f9 commit a335afd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ class DropdownTreeSelect extends Component {
Object.assign(nextState, this.resetSearchState())
}

if (this.props.simpleSelect) {
document.removeEventListener('click', this.handleOutsideClick, false)
}

this.setState(nextState)
this.notifyChange(this.treeManager.getNodeById(id), tags)
}
Expand Down

0 comments on commit a335afd

Please sign in to comment.