[ML] Data Frame Analytics creation: ensure job config validity persists when switching from/to form/editor (#94654)

* persisted validation form state  when switching from editor to form

* persist complete form state when switching from json editor
This commit is contained in:
Melissa Alvarez 2021-03-17 12:14:45 -04:00 committed by GitHub
parent 881b9a5246
commit e9627510fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,8 +558,9 @@ export function reducer(state: State, action: Action): State {
case ACTION.SWITCH_TO_FORM:
const { jobConfig: config } = state;
const { jobId } = state.form;
// Persist form state when switching back from advanced editor
// @ts-ignore
const formState = getFormStateFromJobConfig(config, false);
const formState = { ...state.form, ...getFormStateFromJobConfig(config, false) };
if (typeof jobId === 'string' && jobId.trim() !== '') {
formState.jobId = jobId;