Merge branch 'master' into 'release'
Hotfix api name edit backmerge. See merge request theappsmith/internal-tools-client!737
This commit is contained in:
commit
8bdc1e7563
|
|
@ -816,32 +816,45 @@ export function* refactorActionName(
|
|||
|
||||
function* saveApiNameSaga(action: ReduxAction<{ id: string }>) {
|
||||
// Takes from drafts, checks if the name isValid, saves
|
||||
const apiNameDraftState = yield select(state => state.ui.apiPane.apiName);
|
||||
const apiId = action.payload.id;
|
||||
const apiNameDraft = apiNameDraftState.drafts[apiId];
|
||||
if (apiNameDraft) {
|
||||
const validation = apiNameDraft.validation;
|
||||
if (!validation.isValid) {
|
||||
// If its invalid, then don't save and just remove draft and validation.
|
||||
yield put(
|
||||
updateApiNameDraft({
|
||||
id: action.payload.id,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
const api = yield select(state =>
|
||||
state.entities.actions.find(
|
||||
(action: ActionData) => action.config.id === apiId,
|
||||
),
|
||||
);
|
||||
try {
|
||||
const apiNameDraftState = yield select(state => state.ui.apiPane.apiName);
|
||||
const apiId = action.payload.id;
|
||||
const apiNameDraft = apiNameDraftState.drafts[apiId];
|
||||
if (apiNameDraft) {
|
||||
const validation = apiNameDraft.validation;
|
||||
if (!validation.isValid) {
|
||||
// If its invalid, then don't save and just remove draft and validation.
|
||||
yield put(
|
||||
updateApiNameDraft({
|
||||
id: action.payload.id,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
const api = yield select(state =>
|
||||
state.entities.actions.find(
|
||||
(action: ActionData) => action.config.id === apiId,
|
||||
),
|
||||
);
|
||||
|
||||
yield refactorActionName(
|
||||
api.config.id,
|
||||
api.config.pageId,
|
||||
api.config.name,
|
||||
apiNameDraft.value,
|
||||
);
|
||||
yield refactorActionName(
|
||||
api.config.id,
|
||||
api.config.pageId,
|
||||
api.config.name,
|
||||
apiNameDraft.value,
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
yield put(
|
||||
updateApiNameDraft({
|
||||
id: action.payload.id,
|
||||
}),
|
||||
);
|
||||
AppToaster.show({
|
||||
message: `Unable to update API name`,
|
||||
type: ToastType.ERROR,
|
||||
});
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user