diff --git a/package/src/composables/useHandle.ts b/package/src/composables/useHandle.ts index aafac376..42695bf5 100644 --- a/package/src/composables/useHandle.ts +++ b/package/src/composables/useHandle.ts @@ -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) diff --git a/package/src/utils/graph.ts b/package/src/utils/graph.ts index dff6ecc2..28cec4a6 100644 --- a/package/src/utils/graph.ts +++ b/package/src/utils/graph.ts @@ -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 = (