Skip to content

Commit b230849

Browse files
nilscbHavard Bjerke
authored andcommitted
Fix multiple group trees when data changes (equinor#535)
1 parent 5a75b44 commit b230849

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

react/src/lib/components/GroupTree/components/GroupTreeViewer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ const GroupTreeViewer: React.FC = () => {
3434
(state: GroupTreeState) => state.ui.currentFlowRate
3535
);
3636
useEffect(() => {
37+
// Clear possible elements added from earlier updates.
38+
const node = document.getElementById("grouptree_tree");
39+
if (node) {
40+
node.innerHTML = "";
41+
}
42+
3743
renderer.current = new GroupTree(
3844
"#grouptree_tree",
3945
cloneDeep(data),

0 commit comments

Comments
 (0)