Skip to content

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

@josiah-roberts

Description

@josiah-roberts

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:

  • If an optional field has never been touched, it's undefined
  • If an optional field has been touched, the closest you can get to clearing it is setting it to null

Expected behaviour

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

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions