Hi there! I am using useFormFields to get the dispatch method for an UPDATE action. Sometimes I need to clean a field, so I dispatchName(undefined). That clears the form correctly, but when I click 'Save Draft' the old value reappears and is saved in Mongo. Any insights on what's going on?
const dispatchName = useFormFields(
([_, dispatch]) =>
(value: string) =>
dispatch({
type: 'UPDATE',
path: NamePath,
value: value
})
)
dispatchName(undefined)
P.S: it seems to work better with dispatching 'null'
@jmikrut Do you know if have anyone seen this before?
yeah you will need to send
null
to clear a field
thanks @jmikrut for confirming!