Fix bug on save on unmount (#811)

* Fix tiny code order problem

* Fixed #809
This commit is contained in:
Jesús Espino 2021-08-02 08:06:38 +02:00 committed by GitHub
parent b0cf6d0d2f
commit 2f827ba5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,9 +48,11 @@ const PropertyValueElement = (props:Props): JSX.Element => {
const finalDisplayValue = displayValue || emptyDisplayValue
const [open, setOpen] = useState(false)
const editableFields: Array<PropertyType> = ['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<PropertyType> = ['text', 'number', 'email', 'url', 'phone']
if (
editableFields.includes(propertyTemplate.type)
) {