fix(update): prevent formik reinitialize [EE-4962] (#8426)

pull/8433/head
cmeng 2 years ago committed by GitHub
parent 7fd263e8cc
commit 3470ea049a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,4 @@
import { useMemo } from 'react';
import { Settings } from 'lucide-react';
import { Formik, Form as FormikForm } from 'formik';
import { useRouter } from '@uirouter/react';
@ -25,13 +26,16 @@ import { defaultValue } from '../common/ScheduledTimeField';
export default withLimitToBE(CreateView);
function CreateView() {
const initialValues: FormValues = {
name: '',
groupIds: [],
type: ScheduleType.Update,
version: '',
scheduledTime: defaultValue(),
};
const initialValues = useMemo<FormValues>(
() => ({
name: '',
groupIds: [],
type: ScheduleType.Update,
version: '',
scheduledTime: defaultValue(),
}),
[]
);
const schedulesQuery = useList();

Loading…
Cancel
Save