From 2f827ba5b48e2f13d16ec45d7eb343d1fb99e49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Mon, 2 Aug 2021 08:06:38 +0200 Subject: [PATCH] Fix bug on save on unmount (#811) * Fix tiny code order problem * Fixed #809 --- webapp/src/components/propertyValueElement.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/propertyValueElement.tsx b/webapp/src/components/propertyValueElement.tsx index 567b973d0..b7cb8534d 100644 --- a/webapp/src/components/propertyValueElement.tsx +++ b/webapp/src/components/propertyValueElement.tsx @@ -48,9 +48,11 @@ const PropertyValueElement = (props:Props): JSX.Element => { const finalDisplayValue = displayValue || emptyDisplayValue const [open, setOpen] = useState(false) + const editableFields: Array = ['text', 'number', 'email', 'url', 'phone'] + const saveTextProperty = useCallback(() => { if (editableFields.includes(props.propertyTemplate.type)) { - if (value !== props.card.fields.properties[props.propertyTemplate.id] || '') { + if (value !== (props.card.fields.properties[props.propertyTemplate.id] || '')) { mutator.changePropertyValue(card, propertyTemplate.id, value) } } @@ -232,8 +234,6 @@ const PropertyValueElement = (props:Props): JSX.Element => { ) } - const editableFields: Array = ['text', 'number', 'email', 'url', 'phone'] - if ( editableFields.includes(propertyTemplate.type) ) {