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

View File

@@ -34,6 +34,15 @@ export const UPDATE_NOTE = gql`
update_notes(where: { id: { _eq: $noteId } }, _set: $note) { update_notes(where: { id: { _eq: $noteId } }, _set: $note) {
returning { returning {
id id
created_at
created_by
critical
id
jobid
private
text
updated_at
audit
} }
} }
} }