chore(react/svelte): cleanup edge creation

This commit is contained in:
moklick
2023-11-29 16:33:57 +01:00
parent 1d7803aff7
commit 95acea54d1
3 changed files with 29 additions and 10 deletions
@@ -80,17 +80,17 @@
updateConnection,
cancelConnection,
panBy,
onConnect: (_connection) => {
let connection = $onedgecreate ? $onedgecreate(_connection) : _connection;
onConnect: (connection) => {
const edge = $onedgecreate ? $onedgecreate(connection) : connection;
if (!connection) {
if (!edge) {
return;
}
addEdge(connection);
addEdge(edge);
// @todo: should we change/ improve the stuff we are passing here?
// instead of source/target we could pass fromNodeId, fromHandleId, etc
dispatch('connect', { connection: _connection });
dispatch('connect', { connection });
},
onConnectStart: (event, startParams) => {
dispatch('connectstart', {