From c17dc3aabc4475bc267ed936cf29f634f6792731 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Mon, 30 Jun 2025 10:13:56 +0530 Subject: [PATCH] fix: Updating the util to fix client build failure on EE (#41058) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updating the util to fix client build failure on EE Fixes # ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 84b5b89eeb560056d4d7d74a49281a19aa61073b > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Sat, 28 Jun 2025 15:23:49 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit * **Refactor** * Improved internal logic for identifying action entity types and dependency paths, enhancing the accuracy of dependency misuse detection. No visible changes to the user interface or workflows. --- .../ce/workers/Evaluation/evaluationUtils.ts | 11 +++++ .../DependencyMap/DependencyMapUtils.ts | 43 ++++++++----------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/app/client/src/ce/workers/Evaluation/evaluationUtils.ts b/app/client/src/ce/workers/Evaluation/evaluationUtils.ts index 443fbb318c..dc7e605d87 100644 --- a/app/client/src/ce/workers/Evaluation/evaluationUtils.ts +++ b/app/client/src/ce/workers/Evaluation/evaluationUtils.ts @@ -29,6 +29,7 @@ import type { WidgetEntity, DataTreeEntityConfig, WidgetEntityConfig, + ActionEntityConfig, } from "ee/entities/DataTree/types"; import type { EvalProps } from "workers/common/DataTreeEvaluator"; import { validateWidgetProperty } from "workers/common/DataTreeEvaluator/validationUtils"; @@ -403,6 +404,16 @@ export function isAction( ); } +export function isActionConfig( + entity: DataTreeEntityConfig, +): entity is ActionEntityConfig { + return ( + typeof entity === "object" && + "ENTITY_TYPE" in entity && + entity.ENTITY_TYPE === ENTITY_TYPE.ACTION + ); +} + export function isAppsmithEntity( entity: DataTreeEntity, ): entity is AppsmithEntity { diff --git a/app/client/src/entities/DependencyMap/DependencyMapUtils.ts b/app/client/src/entities/DependencyMap/DependencyMapUtils.ts index 933343f9e2..e8f703b977 100644 --- a/app/client/src/entities/DependencyMap/DependencyMapUtils.ts +++ b/app/client/src/entities/DependencyMap/DependencyMapUtils.ts @@ -4,8 +4,8 @@ import { entityTypeCheckForPathDynamicTrigger, getEntityNameAndPropertyPath, IMMEDIATE_PARENT_REGEX, - isAction, - isJSAction, + isActionConfig, + isJSActionConfig, } from "ee/workers/Evaluation/evaluationUtils"; import type { ConfigTree } from "entities/DataTree/dataTreeTypes"; import { isPathDynamicTrigger } from "utils/DynamicBindingUtils"; @@ -174,8 +174,8 @@ export class DependencyMapUtils { const { entityName: nodeName } = getEntityNameAndPropertyPath(node); const nodeConfig = configTree[nodeName]; - const isJSActionEntity = isJSAction(nodeConfig); - const isActionEntity = isAction(nodeConfig); + const isJSActionEntity = isJSActionConfig(nodeConfig); + const isActionEntity = isActionConfig(nodeConfig); if (isJSActionEntity) { // Only continue if at least one function is automatic @@ -205,28 +205,23 @@ export class DependencyMapUtils { ); for (const dep of transitiveDeps) { - const { entityName } = getEntityNameAndPropertyPath(dep); - const entityConfig = configTree[entityName]; + if (this.isTriggerPath(dep, configTree)) { + hasRun = true; + runPath = dep; + } - if (entityConfig && entityConfig.ENTITY_TYPE === "ACTION") { - if (this.isTriggerPath(dep, configTree)) { - hasRun = true; - runPath = dep; - } + if (this.isDataPath(dep)) { + hasData = true; + dataPath = dep; + } - if (DependencyMapUtils.isDataPath(dep)) { - hasData = true; - dataPath = dep; - } - - if (hasRun && hasData) { - throw Object.assign( - new Error( - `Reactive dependency misuse: '${node}' depends on both trigger path '${runPath}' and data path '${dataPath}' from the same entity. This can cause unexpected reactivity.`, - ), - { node, triggerPath: runPath, dataPath }, - ); - } + if (hasRun && hasData) { + throw Object.assign( + new Error( + `Reactive dependency misuse: '${node}' depends on both trigger path '${runPath}' and data path '${dataPath}' from the same entity. This can cause unexpected reactivity.`, + ), + { node, triggerPath: runPath, dataPath }, + ); } } }