Browse Source

fix: error when connecting package block

Ahmad Kholid 2 năm trước cách đây
mục cha
commit
1bacea29cb

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

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