Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5235cf4
adding logic for reactive actions in post eval flow
ankitakinger Jun 17, 2025
1d62582
fixing client build issue
ankitakinger Jun 18, 2025
b5f9936
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Jun 18, 2025
0187825
fixing actionProperties.test.ts
ankitakinger Jun 18, 2025
7f5994e
fixing evalTreeWithChanges.test.ts
ankitakinger Jun 18, 2025
a83a98e
fixing dataTreeJSAction.test.ts
ankitakinger Jun 18, 2025
eec25b7
fixing evaluation.test.ts
ankitakinger Jun 18, 2025
b2bf719
minor changes
ankitakinger Jun 18, 2025
82a3ea6
fixing DependencyMap/__tests__/index.test.ts
ankitakinger Jun 18, 2025
f56115b
fixing dataTreeEvaluator.test.ts
ankitakinger Jun 18, 2025
fa24300
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Jun 18, 2025
049a8e6
resolving a cyclic dependency
ankitakinger Jun 18, 2025
90280b1
resolving a cyclic dependency
ankitakinger Jun 18, 2025
f5235e5
minor change
ankitakinger Jun 19, 2025
a3eb005
adding initial state
ankitakinger Jun 19, 2025
e9faded
deleting unwanted files
ankitakinger Jun 19, 2025
3ba0270
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Jun 19, 2025
8dde32e
adding flag check and updating types
ankitakinger Jun 19, 2025
e839cbd
adding analytics
ankitakinger Jun 19, 2025
273adeb
reverting TriggerMeta type changes
ankitakinger Jun 19, 2025
35a4e20
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Jun 19, 2025
101e298
fixing a cyclic dependency
ankitakinger Jun 19, 2025
f771e2b
moved evalSubType enum to constants to reduce cyclic dependency
Jun 19, 2025
1bc1d3e
splitting a type
ankitakinger Jun 19, 2025
d6e378e
Merge branch 'feat/reactive-actions' of https://github.com/appsmithor…
ankitakinger Jun 19, 2025
0e88378
fix: evalSubType imports fixed
Jun 19, 2025
dd23613
Merge branch 'feat/reactive-actions' of https://github.com/appsmithor…
Jun 19, 2025
3ebef44
imports for evalSubType fixed
Jun 19, 2025
c159805
js module instance not reactive issue fixed
Jun 20, 2025
564fce2
fix for runBehaviour updates not triggering reactive flow until refresh
ankitakinger Jun 20, 2025
b666a59
Merge branch 'feat/reactive-actions' of https://github.com/appsmithor…
ankitakinger Jun 20, 2025
b7c967b
fixing updateDependencies to execute newly binded queries in reactive…
ankitakinger Jun 20, 2025
9eaeab8
addressing coderabbitai comments
ankitakinger Jun 20, 2025
dad8877
Merge pull request #41014 from appsmithorg/fix/update-dependency-map
ankitakinger Jun 23, 2025
5c2ce16
addressing review comments
ankitakinger Jun 23, 2025
2c1123e
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger Jun 23, 2025
d9d2225
removing a piece of code
ankitakinger Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ const PageActionTypes = {
SET_PAGE_ORDER_INIT: "SET_PAGE_ORDER_INIT",
SET_PAGE_ORDER_SUCCESS: "SET_PAGE_ORDER_SUCCESS",
RESET_PAGE_LIST: "RESET_PAGE_LIST",
SET_ONLOAD_ACTION_EXECUTED: "SET_ONLOAD_ACTION_EXECUTED",
EXECUTE_REACTIVE_QUERIES: "EXECUTE_REACTIVE_QUERIES",
};

const PageActionErrorTypes = {
Expand Down
27 changes: 27 additions & 0 deletions app/client/src/ce/entities/DataTree/dataTreeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
ActionEntity,
ActionEntityConfig,
} from "ee/entities/DataTree/types";
import { EvaluationSubstitutionType } from "constants/EvaluationConstants";

export const generateDataTreeAction = (
action: ActionData,
Expand Down Expand Up @@ -55,6 +56,30 @@ export const generateDataTreeAction = (
dynamicBindingPathList,
);

//this is for view mode
if (action.config.jsonPathKeys && !action.config?.datasource) {
dependencyMap["config.body"] = action.config.jsonPathKeys;
const result = action.config.jsonPathKeys
.map((item) => `{{${item}}}`)
.join(" ");

action.config.actionConfiguration = {
...action.config.actionConfiguration,
body: result,
};
dynamicBindingPathList.push({
key: "config.body",
});
bindingPaths["config.body"] = EvaluationSubstitutionType.TEMPLATE;
reactivePaths["config.body"] = EvaluationSubstitutionType.TEMPLATE;
}

dependencyMap["run"] = dynamicBindingPathList.map(
(path: { key: string }) => path.key,
);

const dynamicTriggerPathList = [{ key: "run" }, { key: "clear" }];

return {
unEvalEntity: {
actionId: action.config.id,
Expand Down Expand Up @@ -84,6 +109,8 @@ export const generateDataTreeAction = (
reactivePaths,
dependencyMap,
logBlackList: {},
dynamicTriggerPathList,
runBehaviour: action.config.runBehaviour,
},
};
};
24 changes: 24 additions & 0 deletions app/client/src/ce/entities/DataTree/dataTreeJSAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ describe("generateDataTreeJSAction", () => {
myFun2: {
arguments: [],
confirmBeforeExecute: false,
runBehaviour: "MANUAL",
},
myFun1: {
arguments: [],
confirmBeforeExecute: false,
runBehaviour: "MANUAL",
},
},
bindingPaths: {
Expand Down Expand Up @@ -184,10 +186,20 @@ describe("generateDataTreeJSAction", () => {
dependencyMap: {
body: ["myFun2", "myFun1"],
},
dynamicTriggerPathList: [
{
key: "myFun2",
},
{
key: "myFun1",
},
],
reactivePaths: {
body: "SMART_SUBSTITUTE",
myFun1: "SMART_SUBSTITUTE",
"myFun1.data": "SMART_SUBSTITUTE",
myFun2: "SMART_SUBSTITUTE",
"myFun2.data": "SMART_SUBSTITUTE",
myVar1: "SMART_SUBSTITUTE",
myVar2: "SMART_SUBSTITUTE",
},
Expand Down Expand Up @@ -347,10 +359,12 @@ describe("generateDataTreeJSAction", () => {
myFun2: {
arguments: [],
confirmBeforeExecute: false,
runBehaviour: "MANUAL",
},
myFun1: {
arguments: [],
confirmBeforeExecute: false,
runBehaviour: "MANUAL",
},
},
bindingPaths: {
Expand Down Expand Up @@ -381,12 +395,22 @@ describe("generateDataTreeJSAction", () => {
dependencyMap: {
body: ["myFun2", "myFun1"],
},
dynamicTriggerPathList: [
{
key: "myFun2",
},
{
key: "myFun1",
},
],
name: "JSObject2",
pluginType: "JS",
reactivePaths: {
body: "SMART_SUBSTITUTE",
myFun1: "SMART_SUBSTITUTE",
"myFun1.data": "SMART_SUBSTITUTE",
myFun2: "SMART_SUBSTITUTE",
"myFun2.data": "SMART_SUBSTITUTE",
myVar1: "SMART_SUBSTITUTE",
myVar2: "SMART_SUBSTITUTE",
},
Expand Down
11 changes: 9 additions & 2 deletions app/client/src/ce/entities/DataTree/dataTreeJSAction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ENTITY_TYPE } from "ee/entities/DataTree/types";
import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer";
import { EvaluationSubstitutionType } from "ee/entities/DataTree/types";
import { EvaluationSubstitutionType } from "constants/EvaluationConstants";
import type { DependencyMap } from "utils/DynamicBindingUtils";
import type {
JSActionEntity,
Expand All @@ -19,6 +19,7 @@ export const generateDataTreeJSAction = (
const meta: Record<string, MetaArgs> = {};
const dynamicBindingPathList = [];
const bindingPaths: Record<string, EvaluationSubstitutionType> = {};
const reactivePaths: Record<string, EvaluationSubstitutionType> = {};
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const variableList: Record<string, any> = {};
Expand Down Expand Up @@ -50,6 +51,7 @@ export const generateDataTreeJSAction = (
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const actionsData: Record<string, any> = {};
const dynamicTriggerPathList = [];

if (actions) {
for (let i = 0; i < actions.length; i++) {
Expand All @@ -58,6 +60,7 @@ export const generateDataTreeJSAction = (
meta[action.name] = {
arguments: action.actionConfiguration?.jsArguments || [],
confirmBeforeExecute: !!action.confirmBeforeExecute,
runBehaviour: action.runBehaviour,
};
bindingPaths[action.name] = EvaluationSubstitutionType.SMART_SUBSTITUTE;
dynamicBindingPathList.push({ key: action.name });
Expand All @@ -67,6 +70,9 @@ export const generateDataTreeJSAction = (
// Action data is updated directly to the dataTree (see updateActionData.ts)
data: {},
};
dynamicTriggerPathList.push({ key: action.name });
reactivePaths[`${action.name}.data`] =
EvaluationSubstitutionType.SMART_SUBSTITUTE;
}
}

Expand All @@ -85,11 +91,12 @@ export const generateDataTreeJSAction = (
pluginType: js.config.pluginType,
ENTITY_TYPE: ENTITY_TYPE.JSACTION,
bindingPaths: bindingPaths, // As all js object function referred to as action is user javascript code, we add them as binding paths.
reactivePaths: { ...bindingPaths },
reactivePaths: { ...reactivePaths, ...bindingPaths },
dynamicBindingPathList: dynamicBindingPathList,
variables: listVariables,
dependencyMap: dependencyMap,
actionNames: new Set(actions.map((action) => action.name)),
dynamicTriggerPathList: dynamicTriggerPathList,
},
};
};
43 changes: 6 additions & 37 deletions app/client/src/ce/entities/DataTree/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@ import type { ActionDescription } from "ee/workers/Evaluation/fns";
import type { Variable } from "entities/JSCollection";
import type { DependencyMap, DynamicPath } from "utils/DynamicBindingUtils";
import type { Page } from "entities/Page";
import type { MetaWidgetsReduxState } from "reducers/entityReducers/metaWidgetsReducer";
import type { WidgetConfigProps } from "WidgetProvider/types";
import type { ActionDataState } from "ee/reducers/entityReducers/actionsReducer";
import type { WidgetProps } from "widgets/BaseWidget";
import type { CanvasWidgetsReduxState } from "ee/reducers/entityReducers/canvasWidgetsReducer";
import type { MetaState } from "reducers/entityReducers/metaReducer";
import type { AppDataState } from "reducers/entityReducers/appReducer";
import type { JSCollectionDataState } from "ee/reducers/entityReducers/jsActionsReducer";
import type { AppTheme } from "entities/AppTheming";
import type { LoadingEntitiesState } from "reducers/evaluationReducers/loadingEntitiesReducer";
import type { LayoutSystemTypes } from "layoutSystems/types";
import type { Module } from "ee/constants/ModuleConstants";
import type { ModuleInstance } from "ee/constants/ModuleInstanceConstants";
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
import type { EvaluationSubstitutionType } from "constants/EvaluationConstants";

// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -36,12 +29,6 @@ export const ACTION_TYPE = ENTITY_TYPE.ACTION;
type ValueOf<T> = T[keyof T];
export type EntityTypeValue = ValueOf<typeof ENTITY_TYPE>;

export enum EvaluationSubstitutionType {
TEMPLATE = "TEMPLATE",
PARAMETER = "PARAMETER",
SMART_SUBSTITUTE = "SMART_SUBSTITUTE",
}

// Action entity types
export interface ActionEntity {
actionId: string;
Expand Down Expand Up @@ -73,13 +60,16 @@ export interface ActionEntityConfig extends EntityConfig {
moduleId?: string;
moduleInstanceId?: string;
isPublic?: boolean;
dynamicTriggerPathList: DynamicPath[];
runBehaviour: ActionRunBehaviourType;
}

// JSAction (JSObject) entity Types

export interface MetaArgs {
arguments: Variable[];
confirmBeforeExecute: boolean;
runBehaviour: ActionRunBehaviourType;
}

export interface JSActionEntityConfig extends EntityConfig {
Expand All @@ -97,6 +87,7 @@ export interface JSActionEntityConfig extends EntityConfig {
moduleInstanceId?: string;
isPublic?: boolean;
actionNames: Set<string>;
dynamicTriggerPathList: DynamicPath[];
}

export interface JSActionEntity {
Expand Down Expand Up @@ -196,28 +187,6 @@ export interface AppsmithEntity extends Omit<AppDataState, "store"> {
currentEnvironmentName: string;
}

export interface DataTreeSeed {
actions: ActionDataState;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
editorConfigs: Record<string, any[]>;
pluginDependencyConfig: Record<string, DependencyMap>;
widgets: CanvasWidgetsReduxState;
widgetsMeta: MetaState;
appData: AppDataState;
jsActions: JSCollectionDataState;
theme: AppTheme["properties"];
metaWidgets: MetaWidgetsReduxState;
isMobile: boolean;
moduleInputs: Module["inputsForm"];
moduleInstances: Record<string, ModuleInstance> | null;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
moduleInstanceEntities: any;
layoutSystemType: LayoutSystemTypes;
loadingEntities: LoadingEntitiesState;
}

export type DataTreeEntityConfig =
| WidgetEntityConfig
| ActionEntityConfig
Expand Down
34 changes: 34 additions & 0 deletions app/client/src/ce/entities/DataTree/types/DataTreeSeed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { CanvasWidgetsReduxState } from "ee/reducers/entityReducers/canvasWidgetsReducer";
import type { ActionDataState } from "ee/reducers/entityReducers/actionsReducer";
import type DependencyMap from "entities/DependencyMap";
import type { MetaState } from "reducers/entityReducers/metaReducer";
import type { AppDataState } from "reducers/entityReducers/appReducer";
import type { JSCollectionDataState } from "ee/reducers/entityReducers/jsActionsReducer";
import type { MetaWidgetsReduxState } from "reducers/entityReducers/metaWidgetsReducer";
import type { AppTheme } from "entities/AppTheming";
import type { Module } from "ee/constants/ModuleConstants";
import type { ModuleInstance } from "ee/constants/ModuleInstanceConstants";
import type { LayoutSystemTypes } from "layoutSystems/types";
import type { LoadingEntitiesState } from "reducers/evaluationReducers/loadingEntitiesReducer";

export interface DataTreeSeed {
actions: ActionDataState;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
editorConfigs: Record<string, any[]>;
pluginDependencyConfig: Record<string, DependencyMap>;
widgets: CanvasWidgetsReduxState;
widgetsMeta: MetaState;
appData: AppDataState;
jsActions: JSCollectionDataState;
theme: AppTheme["properties"];
metaWidgets: MetaWidgetsReduxState;
isMobile: boolean;
moduleInputs: Module["inputsForm"];
moduleInstances: Record<string, ModuleInstance> | null;
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
moduleInstanceEntities: any;
layoutSystemType: LayoutSystemTypes;
loadingEntities: LoadingEntitiesState;
}
Loading
Loading