diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx index 4e16158c3c32..5097ac4efa3c 100644 --- a/app/client/src/api/ActionAPI.tsx +++ b/app/client/src/api/ActionAPI.tsx @@ -171,20 +171,28 @@ class ActionAPI extends API { ActionAPI.apiUpdateCancelTokenSource.cancel(); } ActionAPI.apiUpdateCancelTokenSource = axios.CancelToken.source(); - const action: Partial = { + const payload: Partial = { ...apiConfig, name: undefined, entityReferenceType: undefined, - }; - if (action.datasource != null) { - action.datasource = { - ...(action as any).datasource, + actionConfiguration: apiConfig.actionConfiguration && { + ...apiConfig.actionConfiguration, + autoGeneratedHeaders: + apiConfig.actionConfiguration.autoGeneratedHeaders?.map( + (header: any) => ({ + ...header, + isInvalid: undefined, + }), + ) ?? undefined, + }, + datasource: apiConfig.datasource && { + ...(apiConfig as any).datasource, datasourceStorages: undefined, isValid: undefined, new: undefined, - }; - } - return API.put(`${ActionAPI.url}/${action.id}`, action, undefined, { + }, + }; + return API.put(`${ActionAPI.url}/${apiConfig.id}`, payload, undefined, { cancelToken: ActionAPI.apiUpdateCancelTokenSource.token, }); } @@ -228,7 +236,19 @@ class ActionAPI extends API { } static async moveAction(moveRequest: MoveActionRequest) { - return API.put(ActionAPI.url + "/move", moveRequest, undefined, { + const payload = { + ...moveRequest, + action: moveRequest.action && { + ...moveRequest.action, + entityReferenceType: undefined, + datasource: moveRequest.action.datasource && { + ...moveRequest.action.datasource, + isValid: undefined, + new: undefined, + }, + }, + }; + return API.put(ActionAPI.url + "/move", payload, undefined, { timeout: DEFAULT_EXECUTE_ACTION_TIMEOUT_MS, }); } diff --git a/app/client/src/api/AppThemingApi.tsx b/app/client/src/api/AppThemingApi.tsx index 695c5b258307..e5d8c7e908a8 100644 --- a/app/client/src/api/AppThemingApi.tsx +++ b/app/client/src/api/AppThemingApi.tsx @@ -45,9 +45,13 @@ class AppThemingApi extends API { applicationId: string, theme: AppTheme, ): Promise>> { + const payload = { + ...theme, + new: undefined, + }; return API.put( `${AppThemingApi.baseUrl}/themes/applications/${applicationId}`, - theme, + payload, ); } diff --git a/app/client/src/api/PageApi.tsx b/app/client/src/api/PageApi.tsx index fdb81b344f07..8aeedfac9c8f 100644 --- a/app/client/src/api/PageApi.tsx +++ b/app/client/src/api/PageApi.tsx @@ -262,10 +262,14 @@ class PageApi extends Api { static async generateTemplatePage( request: GenerateTemplatePageRequest, ): Promise> { + const payload = { + ...request, + pageId: undefined, + }; if (request.pageId) { - return Api.put(PageApi.getGenerateTemplateURL(request.pageId), request); + return Api.put(PageApi.getGenerateTemplateURL(request.pageId), payload); } else { - return Api.post(PageApi.getGenerateTemplateURL(), request); + return Api.post(PageApi.getGenerateTemplateURL(), payload); } }