OneForm
OneForm copied to clipboard
`undefined` values don't work in `Field`'s `onChange`
(The continuing adventures of using OneForm
with PrimeReact
, part N+1 :D)
Seems like when the input component calls onChange
with either just undefined
as a value or with event.target.value
as undefined
, the onChange
is just ignored. By looking through the code from when I did the Typescript typings with additions of what I've been PR-ing but not your own changes since (way easier for me to actually read and reason about, though by now a bit out of date), I ended up in useValueState
which should delete the value from the local values dictionary when it's undefined
, but either it's not calling OneForm
's onChange
(it's what I'm using to observe the form value's state while developing the component wrappers), or somehow the change is just broken. Really not sure what's happening or if this might be a regression from the code I'm looking at.
I'm getting around it easily enough (by now I even have my own hooks to generate translateProps
and one of them contains a value mapper so I can just replace undefined
with null
which works fine for my current purpose), but it's definitely unintended/buggy behavior I think (and might trip up some people using the library)