Skip to content

Commit 82e5690

Browse files
committed
revert: 撤销更新
1 parent 1b3307b commit 82e5690

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/BootstrapBlazor/Components/TreeView/TreeView.razor.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -681,15 +681,12 @@ private async Task OnToggleNodeAsync(TreeViewItem<TItem> node, bool shouldRender
681681
if (node.IsExpand)
682682
{
683683
// 通过 item 找到父节点
684-
var parentNode = TreeNodeStateCache.FindParentNode(Items, node)?.Items;
685-
if (parentNode != null)
684+
var nodes = TreeNodeStateCache.FindParentNode(Items, node)?.Items ?? Items;
685+
foreach (var n in nodes.Where(n => n != node))
686686
{
687-
foreach (var n in parentNode.Where(n => n != node))
688-
{
689-
// 收缩同级节点
690-
n.IsExpand = false;
691-
await TreeNodeStateCache.ToggleNodeAsync(n, GetChildrenRowAsync);
692-
}
687+
// 收缩同级节点
688+
n.IsExpand = false;
689+
await TreeNodeStateCache.ToggleNodeAsync(n, GetChildrenRowAsync);
693690
}
694691
}
695692
_rows = null;

0 commit comments

Comments
 (0)