fix(EditViewDataManagerProvider): allow to reset number input

Previously, deleting the numeric value from a number input would send an
empty string to the backend. The backend would convert that empty string
to 0, meaning that after setting a number, it would be impossible to
reset it to an empty field.

Signed-off-by: Pablo Rodríguez Caballero <pablo@rodriguezcaballero.me>
This commit is contained in:
Pablo Rodríguez Caballero 2020-03-03 17:27:20 +01:00
parent 0f3fd09a1c
commit e1549e7612
No known key found for this signature in database
GPG Key ID: 2788EF5E4218A68E

View File

@ -203,6 +203,11 @@ const EditViewDataManagerProvider = ({
inputValue = null;
}
// Allow to reset number input
if (type === 'number' && value === '') {
inputValue = null;
}
dispatch({
type: 'ON_CHANGE',
keys: name.split('.'),