فهرست منبع

fix: "Data exist" in the conditions block

Ahmad Kholid 2 سال پیش
والد
کامیت
cf1a4813a7
2فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 1 1
      src/utils/shared.js
  2. 9 1
      src/utils/testConditions.js

+ 1 - 1
src/utils/shared.js

@@ -1659,7 +1659,7 @@ export const conditionBuilder = {
       placeholder: 'name',
     },
     dataPath: {
-      label: 'variables.variableName',
+      label: 'variables@variableName',
       placeholder: '',
     },
   },

+ 9 - 1
src/utils/testConditions.js

@@ -43,7 +43,15 @@ export default async function (conditionsArr, workflowData) {
 
   async function getConditionItemValue({ type, data }) {
     if (type.startsWith('data')) {
-      return objectPath.has(workflowData.refData, data.dataPath);
+      let dataPath = data.dataPath.trim().replace('@', '.');
+      const isInsideBrackets =
+        dataPath.startsWith('{{') && dataPath.endsWith('}}');
+
+      if (isInsideBrackets) {
+        dataPath = dataPath.slice(2, -2).trim();
+      }
+
+      return objectPath.has(workflowData.refData, dataPath);
     }
 
     const copyData = cloneDeep(data);