Skip to content

Commit

Permalink
fix: Guard against accessing null ref with inline search input (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchief committed Feb 23, 2020
1 parent c5bfa8e commit 04309d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Expand Up @@ -88,7 +88,11 @@ class DropdownTreeSelect extends Component {

resetSearchState = () => {
// clear the search criteria and avoid react controlled/uncontrolled warning
this.searchInput.value = ''
// !this.props.inlineSearchInput is gated as inline search is not rendered until dropdown is shown
if (!this.props.inlineSearchInput) {
this.searchInput.value = ''
}

return {
tree: this.treeManager.restoreNodes(), // restore the tree to its pre-search state
searchModeOn: false,
Expand Down

0 comments on commit 04309d7

Please sign in to comment.