fix(core): avoid adding invalid edges (like null or undefined)

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 04658b2c0d
commit aaf106938f
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -448,14 +448,14 @@ export function useActions(
nextEdges = Array.isArray(nextEdges) ? nextEdges : [nextEdges]
const validEdges = state.isValidConnection
? nextEdges.filter((edge) =>
state.isValidConnection!(edge, {
? nextEdges.filter((edge) => {
return state.isValidConnection?.(edge, {
edges: state.edges,
nodes: state.nodes,
sourceNode: findNode(edge.source)!,
targetNode: findNode(edge.target)!,
}),
)
})
})
: nextEdges
const changes = validEdges.reduce((edgeChanges, connection) => {