Selaa lähdekoodia

fix: channel closed

Ahmad Kholid 3 vuotta sitten
vanhempi
commit
d5ccf3b92b

+ 2 - 1
src/background/workflowEngine/engine.js

@@ -217,7 +217,7 @@ class WorkflowEngine {
   }
 
   addLogHistory(detail) {
-    if (['blocks-group', 'delay'].includes(detail.name)) return;
+    if (detail.name === 'blocks-group') return;
 
     const isLimit = this.history.length >= 1001;
     const notErrorLog = detail.type !== 'error';
@@ -228,6 +228,7 @@ class WorkflowEngine {
     detail.id = this.logHistoryId;
 
     if (
+      detail.name !== 'delay' ||
       detail.replacedValue ||
       detail.name === 'javascript-code' ||
       (tasks[detail.name]?.refDataKeys && this.saveLog)

+ 6 - 1
src/background/workflowEngine/worker.js

@@ -331,7 +331,12 @@ class Worker {
       return data;
     } catch (error) {
       console.error(error);
-      if (error.message?.startsWith('Could not establish connection')) {
+      const noConnection = error.message?.startsWith(
+        'Could not establish connection'
+      );
+      const channelClosed = error.message.includes('message channel closed');
+
+      if (noConnection || channelClosed) {
         const isScriptInjected = await injectContentScript(
           this.activeTab.id,
           this.activeTab.frameId

+ 1 - 1
src/utils/referenceData/mustacheReplacer.js

@@ -185,7 +185,7 @@ function replacer(str, { regex, tagLen, modifyPath, data }) {
 
         Object.assign(replaceResult.list, list);
 
-        return value;
+        return parseJSON(value, value);
       });
 
       result = funcRef.apply({ refData: data }, funcParams);