From 04309d7d251debcb1c54dfbd0ec660e5466a7373 Mon Sep 17 00:00:00 2001 From: Hrusikesh Panda Date: Sat, 22 Feb 2020 20:16:01 -0500 Subject: [PATCH] fix: Guard against accessing null ref with inline search input (#336) --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 28a9c279..96daab8d 100644 --- a/src/index.js +++ b/src/index.js @@ -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,