IO-1010 Fix note modal saving and reset issue.

This commit is contained in:
Patrick Fic
2021-05-06 14:59:34 -07:00
parent 259c8af664
commit 7a1e54cb14
2 changed files with 14 additions and 8 deletions

View File

@@ -36,10 +36,12 @@ export function NoteUpsertModalContainer({
useEffect(() => {
//Required to prevent infinite looping.
if (existingNote) {
if (existingNote && visible) {
form.setFieldsValue(existingNote);
} else if (!existingNote && visible) {
form.resetFields();
}
}, [existingNote, form]);
}, [existingNote, form, visible]);
const handleFinish = (values) => {
if (existingNote) {
@@ -90,12 +92,7 @@ export function NoteUpsertModalContainer({
}}
destroyOnClose
>
<Form
form={form}
onFinish={handleFinish}
initialValues={existingNote}
layout="vertical"
>
<Form form={form} onFinish={handleFinish} layout="vertical">
<NoteUpsertModalComponent form={form} />
</Form>
</Modal>