Merge branch 'dev' of ssh://git.science.uu.nl/ics/sp/2025/n25b/pepperplus-ui into fix/deep-clone-data

This commit is contained in:
JobvAlewijk
2025-12-07 17:07:00 +01:00
28 changed files with 858 additions and 180 deletions

View File

@@ -68,8 +68,8 @@ function DraggableNode({ className, children, nodeType, onDrop }: DraggableNodeP
* @param nodeType - The type of node to create (from `NodeTypes`).
* @param position - The XY position in the flow canvas where the node will appear.
*/
function addNode(nodeType: keyof typeof NodeTypes, position: XYPosition) {
const { nodes, setNodes } = useFlowStore.getState();
function addNodeToFlow(nodeType: keyof typeof NodeTypes, position: XYPosition) {
const { nodes, addNode } = useFlowStore.getState();
// Load any predefined data for this node type.
const defaultData = NodeDefaults[nodeType] ?? {}
@@ -94,7 +94,7 @@ function addNode(nodeType: keyof typeof NodeTypes, position: XYPosition) {
position,
data: JSON.parse(JSON.stringify(defaultData))
}
setNodes([...nodes, newNode]);
addNode(newNode);
}
/**
@@ -129,7 +129,7 @@ export function DndToolbar() {
if (isInFlow) {
const position = screenToFlowPosition(screenPosition);
addNode(nodeType, position);
addNodeToFlow(nodeType, position);
}
},
[screenToFlowPosition],