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,
|
WidgetEntity,
|
||||||
DataTreeEntityConfig,
|
DataTreeEntityConfig,
|
||||||
WidgetEntityConfig,
|
WidgetEntityConfig,
|
||||||
|
ActionEntityConfig,
|
||||||
} from "ee/entities/DataTree/types";
|
} from "ee/entities/DataTree/types";
|
||||||
import type { EvalProps } from "workers/common/DataTreeEvaluator";
|
import type { EvalProps } from "workers/common/DataTreeEvaluator";
|
||||||
import { validateWidgetProperty } from "workers/common/DataTreeEvaluator/validationUtils";
|
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(
|
export function isAppsmithEntity(
|
||||||
entity: DataTreeEntity,
|
entity: DataTreeEntity,
|
||||||
): entity is AppsmithEntity {
|
): entity is AppsmithEntity {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import {
|
||||||
entityTypeCheckForPathDynamicTrigger,
|
entityTypeCheckForPathDynamicTrigger,
|
||||||
getEntityNameAndPropertyPath,
|
getEntityNameAndPropertyPath,
|
||||||
IMMEDIATE_PARENT_REGEX,
|
IMMEDIATE_PARENT_REGEX,
|
||||||
isAction,
|
isActionConfig,
|
||||||
isJSAction,
|
isJSActionConfig,
|
||||||
} from "ee/workers/Evaluation/evaluationUtils";
|
} from "ee/workers/Evaluation/evaluationUtils";
|
||||||
import type { ConfigTree } from "entities/DataTree/dataTreeTypes";
|
import type { ConfigTree } from "entities/DataTree/dataTreeTypes";
|
||||||
import { isPathDynamicTrigger } from "utils/DynamicBindingUtils";
|
import { isPathDynamicTrigger } from "utils/DynamicBindingUtils";
|
||||||
|
|
@ -174,8 +174,8 @@ export class DependencyMapUtils {
|
||||||
const { entityName: nodeName } = getEntityNameAndPropertyPath(node);
|
const { entityName: nodeName } = getEntityNameAndPropertyPath(node);
|
||||||
const nodeConfig = configTree[nodeName];
|
const nodeConfig = configTree[nodeName];
|
||||||
|
|
||||||
const isJSActionEntity = isJSAction(nodeConfig);
|
const isJSActionEntity = isJSActionConfig(nodeConfig);
|
||||||
const isActionEntity = isAction(nodeConfig);
|
const isActionEntity = isActionConfig(nodeConfig);
|
||||||
|
|
||||||
if (isJSActionEntity) {
|
if (isJSActionEntity) {
|
||||||
// Only continue if at least one function is automatic
|
// Only continue if at least one function is automatic
|
||||||
|
|
@ -205,28 +205,23 @@ export class DependencyMapUtils {
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const dep of transitiveDeps) {
|
for (const dep of transitiveDeps) {
|
||||||
const { entityName } = getEntityNameAndPropertyPath(dep);
|
if (this.isTriggerPath(dep, configTree)) {
|
||||||
const entityConfig = configTree[entityName];
|
hasRun = true;
|
||||||
|
runPath = dep;
|
||||||
|
}
|
||||||
|
|
||||||
if (entityConfig && entityConfig.ENTITY_TYPE === "ACTION") {
|
if (this.isDataPath(dep)) {
|
||||||
if (this.isTriggerPath(dep, configTree)) {
|
hasData = true;
|
||||||
hasRun = true;
|
dataPath = dep;
|
||||||
runPath = dep;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (DependencyMapUtils.isDataPath(dep)) {
|
if (hasRun && hasData) {
|
||||||
hasData = true;
|
throw Object.assign(
|
||||||
dataPath = dep;
|
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.`,
|
||||||
|
),
|
||||||
if (hasRun && hasData) {
|
{ node, triggerPath: runPath, dataPath },
|
||||||
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