From 5ef0da5b1e75d08170544dd28ecc27680398ec1c Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 2 Sep 2020 12:12:32 +0200 Subject: [PATCH] Simpify logic --- .../components/AttributePage/AttributePage.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/attributes/components/AttributePage/AttributePage.tsx b/src/attributes/components/AttributePage/AttributePage.tsx index 2aa7aa0c9..9fe12bdb0 100644 --- a/src/attributes/components/AttributePage/AttributePage.tsx +++ b/src/attributes/components/AttributePage/AttributePage.tsx @@ -119,16 +119,12 @@ const AttributePage: React.FC = ({ }; const handleSubmit = (data: AttributePageFormData) => { - const metadata = !attribute - ? data.metadata - : isMetadataModified - ? data.metadata - : undefined; - const privateMetadata = !attribute - ? data.privateMetadata - : isPrivateMetadataModified - ? data.privateMetadata - : undefined; + const metadata = + !attribute || isMetadataModified ? data.metadata : undefined; + const privateMetadata = + !attribute || isPrivateMetadataModified + ? data.privateMetadata + : undefined; onSubmit({ ...data,