fix: show loading state in JS Editor (#12820)
This commit is contained in:
parent
f973c2d86d
commit
b102d32761
|
|
@ -54,7 +54,7 @@ export const refactorJSCollectionAction = (payload: {
|
|||
};
|
||||
};
|
||||
|
||||
export const executeJSFunction = (payload: {
|
||||
export const executeJSFunctionInit = (payload: {
|
||||
collectionName: string;
|
||||
action: JSAction;
|
||||
collectionId: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { createReducer } from "utils/AppsmithUtils";
|
||||
import { JSCollection } from "entities/JSCollection";
|
||||
import { JSAction, JSCollection } from "entities/JSCollection";
|
||||
import {
|
||||
ReduxActionTypes,
|
||||
ReduxAction,
|
||||
|
|
@ -247,9 +247,9 @@ const jsActionsReducer = createReducer(initialState, {
|
|||
[ReduxActionTypes.EXECUTE_JS_FUNCTION_INIT]: (
|
||||
state: JSCollectionDataState,
|
||||
action: ReduxAction<{
|
||||
results: any;
|
||||
collectionName: string;
|
||||
collectionId: string;
|
||||
actionId: string;
|
||||
action: JSAction;
|
||||
}>,
|
||||
): JSCollectionDataState =>
|
||||
state.map((a) => {
|
||||
|
|
@ -258,7 +258,7 @@ const jsActionsReducer = createReducer(initialState, {
|
|||
...a,
|
||||
isExecuting: {
|
||||
...a.isExecuting,
|
||||
[action.payload.actionId]: true,
|
||||
[action.payload.action.id]: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import {
|
|||
refactorJSCollectionAction,
|
||||
updateJSCollectionBodySuccess,
|
||||
updateJSFunction,
|
||||
executeJSFunctionInit,
|
||||
} from "actions/jsPaneActions";
|
||||
import { getCurrentOrgId } from "selectors/organizationSelectors";
|
||||
import { getPluginIdOfPackageName } from "sagas/selectors";
|
||||
|
|
@ -303,6 +304,13 @@ export function* handleExecuteJSFunctionSaga(data: {
|
|||
}): any {
|
||||
const { action, collectionId, collectionName } = data;
|
||||
const actionId = action.id;
|
||||
yield put(
|
||||
executeJSFunctionInit({
|
||||
collectionName,
|
||||
action,
|
||||
collectionId,
|
||||
}),
|
||||
);
|
||||
try {
|
||||
const result = yield call(executeFunction, collectionName, action);
|
||||
yield put({
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user