iway1 / react-ts-form

https://react-ts-form.com
MIT License
2.01k stars 33 forks source link

issue: `useTsController` eats `onChange(undefined)` and does not bubble it #137

Open josiah-roberts opened 10 months ago

josiah-roberts commented 10 months ago

Version Number

1.0.6

Codesandbox/Expo snack

No response

Steps to reproduce

  1. Have an optional field
  2. If you never touch it, the field value is unset (undefined)
  3. Touch the field
  4. You can now never set it back to undefined, because useTsController eats onChange(undefined)

This bug means that:

Expected behaviour

Don't eat onChange(undefined). Forward it up to the passed onChange.

Relevant log output

No response