From 6e56594e2dff85df3aa783a50cca6275f00a3c44 Mon Sep 17 00:00:00 2001 From: duanhongbo <6860300@qq.com> Date: Thu, 26 Nov 2020 11:40:09 +0800 Subject: [PATCH] fix: hide folder when searching --- render-process/Properties.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/render-process/Properties.tsx b/render-process/Properties.tsx index 72fdc4d..5fa4f0c 100644 --- a/render-process/Properties.tsx +++ b/render-process/Properties.tsx @@ -122,7 +122,7 @@ class FileDataNode implements DataNode { } removeChilds(exclude:string){ - for (let i = 0;i < this.children.length;++i) { + for (let i = this.children.length-1;i >= 0;--i) { const child = this.children[i]; if (child.isLeaf) { const keyStr = child.key as string; @@ -130,9 +130,13 @@ class FileDataNode implements DataNode { this.children.splice(i,1); } } else { - child.removeChilds(exclude); + const childLen = child.removeChilds(exclude); + if(childLen==0){ + this.children.splice(i,1); + } } } + return this.children.length; } // name:string;