chore: solve merge conflicts with dev
ref: N25B-189
This commit is contained in:
@@ -47,7 +47,11 @@ function DraggableNode({ className, children, nodeType, onDrop }: DraggableNodeP
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={className} ref={draggableRef}>
|
||||
<div className={className}
|
||||
ref={draggableRef}
|
||||
id={`draggable-${nodeType}`}
|
||||
data-testid={`draggable-${nodeType}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
@@ -64,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] ?? {}
|
||||
@@ -90,7 +94,7 @@ function addNode(nodeType: keyof typeof NodeTypes, position: XYPosition) {
|
||||
position,
|
||||
data: {...defaultData}
|
||||
}
|
||||
setNodes([...nodes, newNode]);
|
||||
addNode(newNode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +129,7 @@ export function DndToolbar() {
|
||||
|
||||
if (isInFlow) {
|
||||
const position = screenToFlowPosition(screenPosition);
|
||||
addNode(nodeType, position);
|
||||
addNodeToFlow(nodeType, position);
|
||||
}
|
||||
},
|
||||
[screenToFlowPosition],
|
||||
@@ -149,6 +153,7 @@ export function DndToolbar() {
|
||||
{/* Maps over all the nodes that are droppable, and puts them in the panel */}
|
||||
{droppableNodes.map(({type, data}) => (
|
||||
<DraggableNode
|
||||
key={type}
|
||||
className={styles[`draggable-node-${type}`]} // Our current style signature for nodes
|
||||
nodeType={type}
|
||||
onDrop={handleNodeDrop}
|
||||
|
||||
Reference in New Issue
Block a user