From 06ef285d15bb70c37b4b26d2145725b9994efbd2 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 3 Nov 2020 17:49:11 +0100 Subject: [PATCH] Fix metadata --- src/categories/components/CategoryCreatePage/form.tsx | 3 --- src/categories/components/CategoryUpdatePage/form.tsx | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/categories/components/CategoryCreatePage/form.tsx b/src/categories/components/CategoryCreatePage/form.tsx index 7c1344a0c..0393a005a 100644 --- a/src/categories/components/CategoryCreatePage/form.tsx +++ b/src/categories/components/CategoryCreatePage/form.tsx @@ -55,8 +55,6 @@ function useCategoryCreateForm( }); const { - isMetadataModified, - isPrivateMetadataModified, makeChangeHandler: makeMetadataChangeHandler } = useMetadataChangeTrigger(); @@ -69,7 +67,6 @@ function useCategoryCreateForm( // Need to make it function to always have description.current up to date const getData = (): CategoryCreateData => ({ ...form.data, - ...getMetadata(form.data, isMetadataModified, isPrivateMetadataModified), description: description.current }); diff --git a/src/categories/components/CategoryUpdatePage/form.tsx b/src/categories/components/CategoryUpdatePage/form.tsx index a98c80c1f..809b5a851 100644 --- a/src/categories/components/CategoryUpdatePage/form.tsx +++ b/src/categories/components/CategoryUpdatePage/form.tsx @@ -78,8 +78,12 @@ function useCategoryUpdateForm( ...getMetadata(form.data, isMetadataModified, isPrivateMetadataModified), description: description.current }); + const getSubmitData = (): CategoryUpdateData => ({ + ...getData(), + ...getMetadata(form.data, isMetadataModified, isPrivateMetadataModified) + }); - const submit = () => handleFormSubmit(getData(), onSubmit, setChanged); + const submit = () => handleFormSubmit(getSubmitData(), onSubmit, setChanged); return { change: handleChange,