1
0
Fork 0
mirror of synced 2024-10-01 17:47:46 +13:00

implement review comments

This commit is contained in:
Maurits Lourens 2021-07-26 17:01:29 +02:00
parent d485e95e7b
commit e2de45db23

View file

@ -119,20 +119,19 @@
const clearValue = () => {
const { fieldState } = fieldMap[field]
const newValue = initialValues[field] ?? defaultValue;
fieldState.update(state => {
state.value = defaultValue
state.value = newValue
state.error = null
return state
})
formState.update(state => {
state.values = { ...state.values, [field]: defaultValue }
state.values = { ...state.values, [field]: newValue }
delete state.errors[field]
state.valid = Object.keys(state.errors).length === 0
return state
})
return true
}
return {