Browse Source

fix: `prevBlock` is `undefined` in wait connections block

Ahmad Kholid 3 years ago
parent
commit
7d73f0e3ac

+ 1 - 1
src/background/workflow-engine/blocks-handler/handler-wait-connections.js

@@ -7,7 +7,7 @@ async function waitConnections({ data, outputs, inputs, id }, { prevBlock }) {
 
     const nextBlockId = getBlockConnection({ outputs });
     const destroyWorker =
-      data.specificFlow && prevBlock.id !== data.flowBlockId;
+      data.specificFlow && prevBlock?.id !== data.flowBlockId;
 
     const registerConnections = () => {
       inputs.input_1.connections.forEach(({ node }) => {

+ 1 - 0
src/background/workflow-engine/worker.js

@@ -83,6 +83,7 @@ class Worker {
           windowId: this.windowId,
           loopList: this.loopList,
           activeTab: this.activeTab,
+          currentBlock: this.currentBlock,
           repeatedTasks: this.repeatedTasks,
           preloadScripts: this.preloadScripts,
         });