瀏覽代碼

fix: Condition block 'Data exists' not working for loopData (#1466)

Ahmad Kholid 1 年之前
父節點
當前提交
8237a77db5
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/workflowEngine/utils/testConditions.js

+ 4 - 0
src/workflowEngine/utils/testConditions.js

@@ -3,6 +3,7 @@ import objectPath from 'object-path';
 import { parseJSON } from '@/utils/helper';
 import { conditionBuilder } from '@/utils/shared';
 import renderString from '../templating/renderString';
+import { keyParser } from '../templating/mustacheReplacer';
 
 const isBoolStr = (str) => {
   if (str === 'true') return true;
@@ -59,6 +60,9 @@ export default async function (conditionsArr, workflowData) {
         dataPath = dataPath.slice(2, -2).trim();
       }
 
+      const parsedPath = keyParser(dataPath, workflowData.refData);
+      dataPath = `${parsedPath.dataKey}.${parsedPath.path}`;
+
       return objectPath.has(workflowData.refData, dataPath);
     }