From a78364425c6b4d6dd8bafa5d6c9b9b34cf7de5e1 Mon Sep 17 00:00:00 2001 From: Tim Arney Date: Fri, 19 Jul 2024 09:32:24 -0400 Subject: [PATCH] fix: adds additional check / set for active group (#4037) set active group --- .../components/shared/right-panel/treeview/TreeView.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/(gcforms)/[locale]/(form administration)/form-builder/components/shared/right-panel/treeview/TreeView.tsx b/app/(gcforms)/[locale]/(form administration)/form-builder/components/shared/right-panel/treeview/TreeView.tsx index ca2baeda3b..05ac7cd1ba 100644 --- a/app/(gcforms)/[locale]/(form administration)/form-builder/components/shared/right-panel/treeview/TreeView.tsx +++ b/app/(gcforms)/[locale]/(form administration)/form-builder/components/shared/right-panel/treeview/TreeView.tsx @@ -316,7 +316,13 @@ const ControlledTree: ForwardRefRenderFunction = setId(item.isFolder ? String(item.index) : String(parent?.index)); }} - onExpandItem={(item) => setExpandedItems([...expandedItems, item.index])} + onExpandItem={(item) => { + if (item.index !== groupId) { + setId(String(item.index)); + } + + setExpandedItems([...expandedItems, item.index]); + }} onCollapseItem={(item) => setExpandedItems( expandedItems.filter((expandedItemIndex) => expandedItemIndex !== item.index)