From b2308498d1e3bca08ffc31cf6287625341bf12b0 Mon Sep 17 00:00:00 2001 From: nilscb Date: Thu, 2 Sep 2021 15:06:51 +0200 Subject: [PATCH] Fix multiple group trees when data changes (#535) --- .../lib/components/GroupTree/components/GroupTreeViewer.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/react/src/lib/components/GroupTree/components/GroupTreeViewer.tsx b/react/src/lib/components/GroupTree/components/GroupTreeViewer.tsx index 8a5fa93b9..4d36df737 100644 --- a/react/src/lib/components/GroupTree/components/GroupTreeViewer.tsx +++ b/react/src/lib/components/GroupTree/components/GroupTreeViewer.tsx @@ -34,6 +34,12 @@ const GroupTreeViewer: React.FC = () => { (state: GroupTreeState) => state.ui.currentFlowRate ); useEffect(() => { + // Clear possible elements added from earlier updates. + const node = document.getElementById("grouptree_tree"); + if (node) { + node.innerHTML = ""; + } + renderer.current = new GroupTree( "#grouptree_tree", cloneDeep(data),