fix deep cloning bug where phases don't have their own children but store references #27

Merged
9828273 merged 12 commits from fix/deep-clone-data into dev 2025-12-09 14:55:47 +00:00
Showing only changes of commit 7640c32830 - Show all commits

View File

@@ -75,7 +75,9 @@ function addNode(nodeType: keyof typeof NodeTypes, position: XYPosition) {
id: id, id: id,
type: nodeType, type: nodeType,
position, 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]); setNodes([...nodes, newNode]);
} }