Connections can be validated before edges are created and nodes get connected.
<div>
[ ... ]
<Handle type="source" :is-valid-connection="isValidConnection" />
</div>
const nodes = [
{
id: '1',
label: 'Node 1',
position: { x: 0, y: 0 },
isValidSourcePos: (connection) => {
return connection.target === '2'
},
},
]