regression(edges): Edge update also triggering new connection

# What's changed?

* Fix edge update causing double connections
* Fix updateEdge utility adding two edges on update
This commit is contained in:
Braks
2022-04-21 10:47:53 +02:00
parent 99d062728a
commit 9a5b5465b6
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -160,8 +160,8 @@ export default (store: Store = useVueFlow().store) => {
const isOwnHandle = connection.source === connection.target
if (isValid && !isOwnHandle) {
store.hooks.connect.trigger(connection)
onEdgeUpdate?.(connection)
if (!onEdgeUpdate) store.hooks.connect.trigger(connection)
else onEdgeUpdate(connection)
}
store.hooks.connectEnd.trigger(event)
+1 -1
View File
@@ -195,7 +195,7 @@ export const updateEdge = (oldEdge: Edge, newConnection: Connection, elements: E
targetHandle: newConnection.targetHandle,
}
elements.splice(elements.indexOf(foundEdge), 1, edge)
return elements.filter((e) => e.id !== oldEdge.id).concat(edge)
return elements.filter((e) => e.id !== oldEdge.id)
}
export const pointToRendererPoint = (