fix: fix the creation of new phases so that the data is deepcloned instead of referenced

This commit is contained in:
Björn Otgaar
2025-12-02 12:47:38 +01:00
parent a95fbd15e6
commit 7640c32830

View File

@@ -75,7 +75,9 @@ function addNode(nodeType: keyof typeof NodeTypes, position: XYPosition) {
id: id,
type: nodeType,
position,
data: {...defaultData}
// Deep copy using JSON because thats how things work:
// Ref: https://developer.mozilla.org/en-US/docs/Glossary/Deep_copy
data: structuredClone(defaultData)
}
setNodes([...nodes, newNode]);
}