diff --git a/src/components/nodes/SwitchNode.tsx b/src/components/nodes/SwitchNode.tsx index b171bd8d..01497c36 100644 --- a/src/components/nodes/SwitchNode.tsx +++ b/src/components/nodes/SwitchNode.tsx @@ -92,6 +92,7 @@ export const SwitchNode = memo(({ id, data, selected }: NodeProps) // Handle delete switch const handleDelete = useCallback( (switchId: string) => { + if (nodeData.switches.length <= 1) return; const updatedSwitches = nodeData.switches.filter((sw) => sw.id !== switchId); updateNodeData(id, { switches: updatedSwitches }); @@ -227,26 +228,28 @@ export const SwitchNode = memo(({ id, data, selected }: NodeProps) )} - {/* Delete button */} - + + + + + )} ))}