Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formik is dirty when field undefined and not null #2085

Open
StudioSpindle opened this issue Dec 5, 2019 · 1 comment
Open

Formik is dirty when field undefined and not null #2085

StudioSpindle opened this issue Dec 5, 2019 · 1 comment
Labels

Comments

@StudioSpindle
Copy link

StudioSpindle commented Dec 5, 2019

❓Question

I am using a fetch to populate the initial values for Formik. One of the fields is null in the fetch result (password).

When I use this in a field, and change the input field to a value, the dirty state of the form becomes true.

Then when I remove that value again Formik will stay 'dirty'. Since Formik makes the field 'undefined' and not 'null'.

Does someone have a workaround for this?

@StudioSpindle
Copy link
Author

Example: https://codesandbox.io/s/strange-cerf-29xw6

Steps to reproduce:

  • Fill in the second input field with a word. Note that the submit button becomes active.
  • Remove that entire word again from that field.

Outcome: The submit button stays clickable.
Expected outcome: The submit button should become disabled again.

@stale stale bot added the stale label Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant