From 7a1e54cb14f9e8f641c7de250afeb9f50e4e4015 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 6 May 2021 14:59:34 -0700 Subject: [PATCH] IO-1010 Fix note modal saving and reset issue. --- .../note-upsert-modal.container.jsx | 13 +++++-------- client/src/graphql/notes.queries.js | 9 +++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx b/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx index 9d732ea40..487de84b4 100644 --- a/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx +++ b/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx @@ -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 > -
+ diff --git a/client/src/graphql/notes.queries.js b/client/src/graphql/notes.queries.js index 286e9b5b4..a8d66fc07 100644 --- a/client/src/graphql/notes.queries.js +++ b/client/src/graphql/notes.queries.js @@ -34,6 +34,15 @@ export const UPDATE_NOTE = gql` update_notes(where: { id: { _eq: $noteId } }, _set: $note) { returning { id + created_at + created_by + critical + id + jobid + private + text + updated_at + audit } } }