diff --git a/app/client/src/ce/reducers/uiReducers/editorReducer.tsx b/app/client/src/ce/reducers/uiReducers/editorReducer.tsx index 321bfeafd3ab..9479f10d6600 100644 --- a/app/client/src/ce/reducers/uiReducers/editorReducer.tsx +++ b/app/client/src/ce/reducers/uiReducers/editorReducer.tsx @@ -9,8 +9,9 @@ import type { LayoutOnLoadActionErrors, PageAction, } from "constants/AppsmithActionConstants/ActionConstants"; -import type { UpdatePageResponse } from "api/PageApi"; +import type { SavePageResponse, UpdatePageResponse } from "api/PageApi"; import type { UpdateCanvasPayload } from "actions/pageActions"; +import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes"; export const initialState: EditorReduxState = { widgetConfigBuilt: false, @@ -124,8 +125,33 @@ export const handlers = { return { ...state }; }, - [ReduxActionTypes.SAVE_PAGE_SUCCESS]: (state: EditorReduxState) => { + [ReduxActionTypes.SAVE_PAGE_SUCCESS]: ( + state: EditorReduxState, + action: ReduxAction, + ) => { + const layoutOnLoadActions = action.payload.data.layoutOnLoadActions; + const actionUpdates = action.payload.data.actionUpdates; + const actionUpdatesById = Object.fromEntries( + actionUpdates.map((a) => [a.id, a]), + ); + const newlyBindedActions: Record = {}; + + layoutOnLoadActions.forEach((actionsPerPage) => { + actionsPerPage.forEach((action) => { + const actionUpdate = actionUpdatesById[action.id]; + + if (actionUpdate?.runBehaviour === ActionRunBehaviour.AUTOMATIC) { + newlyBindedActions[action.id] = true; + } + }); + }); + state.loadingStates.saving = false; + state.pageActions = layoutOnLoadActions; + state.onLoadActionExecution = { + ...state.onLoadActionExecution, + ...newlyBindedActions, + }; return { ...state }; }, diff --git a/app/client/src/workers/common/DependencyMap/index.ts b/app/client/src/workers/common/DependencyMap/index.ts index 025dc5fe2b8f..bcd5a1847499 100644 --- a/app/client/src/workers/common/DependencyMap/index.ts +++ b/app/client/src/workers/common/DependencyMap/index.ts @@ -328,6 +328,30 @@ export const updateDependencyMap = ({ const entityConfig = configTree[entityName]; const fullPropertyPath = dataTreeDiff.payload.propertyPath; + const entityDependencyMap = getEntityDependencies( + entity, + configTree[entityName], + allKeys, + ); + + if (!isEmpty(entityDependencyMap)) { + // The entity might already have some dependencies, + // so we just want to update those + Object.entries(entityDependencyMap).forEach( + ([path, pathDependencies]) => { + const { errors: extractDependencyErrors, references } = + extractInfoFromBindings(pathDependencies, allKeys); + + setDependenciesToDepedencyMapFn(path, references); + + didUpdateDependencyMap = true; + dataTreeEvalErrors = dataTreeEvalErrors.concat( + extractDependencyErrors, + ); + }, + ); + } + const entityPathDependencies = getEntityPathDependencies( entity, entityConfig,