Skip to content

Commit

Permalink
Merge 37641fb into 92698cb
Browse files Browse the repository at this point in the history
  • Loading branch information
MJRuskin committed Jun 18, 2020
2 parents 92698cb + 37641fb commit fc8f0a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class DropdownTreeSelect extends Component {
const searchModeOn = value.length > 0

this.setState({
tree,
tree: searchModeOn ? tree : this.treeManager.restoreNodes(),
searchModeOn,
allNodesHidden,
})
Expand Down
5 changes: 4 additions & 1 deletion src/tree-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class TreeManager {
})
this.tree = list
this.defaultValues = defaultValues
this.defaultHidden = Array.from(list)
.filter(item => item[1].hide)
.map(item => item[0])
this.showPartialState = !this.hierarchical && showPartiallySelected
this.searchMaps = new Map()

Expand Down Expand Up @@ -122,7 +125,7 @@ class TreeManager {

restoreNodes() {
this.tree.forEach(node => {
node.hide = false
node.hide = this.defaultHidden.includes(node._id) ? true : false
})

return this.tree
Expand Down

0 comments on commit fc8f0a4

Please sign in to comment.