Browse Source

fix: error when connecting package block

Ahmad Kholid 2 years ago
parent
commit
1bacea29cb
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/newtab/pages/workflows/[id].vue

+ 7 - 1
src/newtab/pages/workflows/[id].vue

@@ -1131,13 +1131,19 @@ function onEditorInit(instance) {
     if (targetNode && targetNode.dataset.id !== nodeToConnect.nodeId) {
       const nodeId = targetNode.dataset.id;
       const nodeData = editor.value.getNode.value(nodeId);
+
       if (nodeData && nodeData.handleBounds.target.length >= 1) {
+        const targetHandle = nodeData.handleBounds.target.find(
+          (item) => item.id
+        );
+        if (!targetHandle) return;
+
         editor.value.addEdges([
           {
             target: nodeId,
             source: nodeToConnect.nodeId,
+            targetHandle: targetHandle.id,
             sourceHandle: nodeToConnect.handleId,
-            targetHandle: nodeData.handleBounds.target[0].id,
           },
         ]);
       }