From 00ea07b181f5544421e78b3350855aa65d4ee64e Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Wed, 11 Nov 2020 17:51:49 +0800 Subject: [PATCH] fix: guard setExpand --- src/utils/VisibleNodesGenerator.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/VisibleNodesGenerator.ts b/src/utils/VisibleNodesGenerator.ts index 48a2516..c4250a7 100644 --- a/src/utils/VisibleNodesGenerator.ts +++ b/src/utils/VisibleNodesGenerator.ts @@ -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) }