From 66d3205f4f185a46154e9a35aa148b5f33eeb962 Mon Sep 17 00:00:00 2001 From: Bhavin K <58818598+techbhavin@users.noreply.github.com> Date: Thu, 4 Aug 2022 17:30:53 +0530 Subject: [PATCH] fix: revert success flag from trigger response (#15641) --- .../ActionExecution/ActionExecutionSagas.ts | 21 ++++--------------- .../sagas/ActionExecution/PluginActionSaga.ts | 7 +------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/app/client/src/sagas/ActionExecution/ActionExecutionSagas.ts b/app/client/src/sagas/ActionExecution/ActionExecutionSagas.ts index 40e30754a4..c39c1d6069 100644 --- a/app/client/src/sagas/ActionExecution/ActionExecutionSagas.ts +++ b/app/client/src/sagas/ActionExecution/ActionExecutionSagas.ts @@ -49,7 +49,6 @@ import { } from "sagas/ActionExecution/GetCurrentLocationSaga"; import { requestModalConfirmationSaga } from "sagas/UtilSagas"; import { ModalType } from "reducers/uiReducers/modalActionReducer"; -import { get, set, size } from "lodash"; export type TriggerMeta = { source?: TriggerSource; @@ -68,7 +67,7 @@ export function* executeActionTriggers( triggerMeta: TriggerMeta, ): any { // when called via a promise, a trigger can return some value to be used in .then - let response: unknown[] = [{ success: true }]; + let response: unknown[] = []; switch (trigger.type) { case ActionTriggerType.RUN_PLUGIN_ACTION: response = yield call( @@ -118,8 +117,6 @@ export function* executeActionTriggers( eventType, triggerMeta, ); - // response return only one object into array - set(response, "0.success", true); break; case ActionTriggerType.WATCH_CURRENT_LOCATION: @@ -129,14 +126,10 @@ export function* executeActionTriggers( eventType, triggerMeta, ); - // response return only one object into array - set(response, "0.success", true); break; case ActionTriggerType.STOP_WATCHING_CURRENT_LOCATION: response = yield call(stopWatchCurrentLocation, eventType, triggerMeta); - // response return only one object into array - set(response, "0.success", true); break; case ActionTriggerType.CONFIRMATION_MODAL: const payloadInfo = { @@ -165,6 +158,7 @@ export function* executeAppAction(payload: ExecuteTriggerPayload): any { source, triggerPropertyName, } = payload; + log.debug({ dynamicString, callbackData, globalContext }); if (dynamicString === undefined) { throw new Error("Executing undefined action"); @@ -188,16 +182,9 @@ function* initiateActionTriggerExecution( // it will be created again while execution AppsmithConsole.deleteError(`${source?.id}-${triggerPropertyName}`); try { - const res: unknown[] = yield call(executeAppAction, action.payload); + yield call(executeAppAction, action.payload); if (event.callback) { - /** - * result.success flag added to fire notification after successfully trigger - * size of triggers checked for dependent action trigger i.e call success message after getting current location - */ - const success = !!( - get(res, "result.success") || size(get(res, "triggers")) - ); - event.callback({ success }); + event.callback({ success: true }); } } catch (e) { if (e instanceof UncaughtPromiseError || e instanceof TriggerFailureError) { diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts index 46d6a3b57d..74359ad5a7 100644 --- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts +++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts @@ -406,14 +406,9 @@ export default function* executePluginActionTriggerSaga( callbackData: [payload.body, params], ...triggerMeta, }); - return [{ success: true }]; } } - // added success flag for successfull api execution and handle callback - return [ - set((payload.body || {}) as Record, "success", true), - params, - ]; + return [payload.body, params]; } function* runActionShortcutSaga() {