fix: guard setExpand

This commit is contained in:
EnixCoda 2020-11-11 17:51:49 +08:00
parent 0c0ee18795
commit 00ea07b181
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -254,7 +254,10 @@ class FlattenLayer extends CompressLayer {
barelySetExpand = (node: TreeNode, expand: boolean) => {
if (expand) {
this.expandedNodes.add(node.path)
if (node.type === 'tree') {
// expanding non-tree node could cause unexpected UX
this.expandedNodes.add(node.path)
}
} else {
this.expandedNodes.delete(node.path)
}