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