fix: Updating the util to fix client build failure on EE (#41058)
## Description Updating the util to fix client build failure on EE Fixes # ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/15942976322> > Commit: 84b5b89eeb560056d4d7d74a49281a19aa61073b > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=15942976322&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Sat, 28 Jun 2025 15:23:49 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
40efc3bd84
commit
c17dc3aabc
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user