瀏覽代碼

fix: block group

Ahmad Kholid 2 年之前
父節點
當前提交
c07a022452
共有 1 個文件被更改,包括 23 次插入27 次删除
  1. 23 27
      src/background/workflowEngine/blocksHandler/handlerBlocksGroup.js

+ 23 - 27
src/background/workflowEngine/blocksHandler/handlerBlocksGroup.js

@@ -11,36 +11,32 @@ function blocksGroup({ data, id }, { prevBlockData }) {
       return;
     }
 
-    if (!this.engine.extractedGroup[id]) {
-      const { blocks, connections } = data.blocks.reduce(
-        (acc, block, index) => {
-          const nextBlock = data.blocks[index + 1]?.itemId;
-
-          acc.blocks[block.itemId] = {
-            label: block.id,
-            data: block.data,
-            id: nextBlock ? block.itemId : id,
-          };
-
-          if (nextBlock) {
-            const outputId = `${block.itemId}-output-1`;
-
-            if (!acc.connections[outputId]) {
-              acc.connections[outputId] = [];
-            }
-            acc.connections[outputId].push(nextBlock);
-          }
+    const { blocks, connections } = data.blocks.reduce(
+      (acc, block, index) => {
+        const nextBlock = data.blocks[index + 1]?.itemId;
 
-          return acc;
-        },
-        { blocks: {}, connections: {} }
-      );
+        acc.blocks[block.itemId] = {
+          label: block.id,
+          data: block.data,
+          id: nextBlock ? block.itemId : id,
+        };
 
-      Object.assign(this.engine.blocks, blocks);
-      Object.assign(this.engine.connectionsMap, connections);
+        if (nextBlock) {
+          const outputId = `${block.itemId}-output-1`;
 
-      this.engine.extractedGroup[id] = true;
-    }
+          if (!acc.connections[outputId]) {
+            acc.connections[outputId] = [];
+          }
+          acc.connections[outputId].push(nextBlock);
+        }
+
+        return acc;
+      },
+      { blocks: {}, connections: {} }
+    );
+
+    Object.assign(this.engine.blocks, blocks);
+    Object.assign(this.engine.connectionsMap, connections);
 
     resolve({
       data: prevBlockData,