Jelajahi Sumber

fix: can't find block when using js block
extBlockId param (#1548)

Ahmad Kholid 1 tahun lalu
induk
melakukan
3f165ff29c
1 mengubah file dengan 12 tambahan dan 1 penghapusan
  1. 12 1
      src/workflowEngine/blocksHandler/handlerJavascriptCode.js

+ 12 - 1
src/workflowEngine/blocksHandler/handlerJavascriptCode.js

@@ -222,10 +222,21 @@ export async function javascriptCode({ outputs, data, ...block }, { refData }) {
       insert = typeof insertData === 'boolean' ? insertData : true;
 
       if (inputNextBlockId) {
-        const customNextBlockId = this.getBlockConnections(inputNextBlockId);
+        let customNextBlockId = this.getBlockConnections(inputNextBlockId);
         if (!customNextBlockId)
           throw new Error(`Can't find block with "${inputNextBlockId}" id`);
 
+        const nextBlock = this.engine.blocks[inputNextBlockId];
+        if (!customNextBlockId && nextBlock) {
+          customNextBlockId = [
+            {
+              id: inputNextBlockId,
+              blockId: inputNextBlockId,
+              connections: new Map([]),
+            },
+          ];
+        }
+
         nextBlockId = customNextBlockId;
       }
     } else {