Skip to content

Commit 04309d7

Browse files
authored
fix: Guard against accessing null ref with inline search input (#336)
1 parent c5bfa8e commit 04309d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ class DropdownTreeSelect extends Component {
8888

8989
resetSearchState = () => {
9090
// clear the search criteria and avoid react controlled/uncontrolled warning
91-
this.searchInput.value = ''
91+
// !this.props.inlineSearchInput is gated as inline search is not rendered until dropdown is shown
92+
if (!this.props.inlineSearchInput) {
93+
this.searchInput.value = ''
94+
}
95+
9296
return {
9397
tree: this.treeManager.restoreNodes(), // restore the tree to its pre-search state
9498
searchModeOn: false,

0 commit comments

Comments
 (0)