Skip to content

When using "push" and then "remove" the form stays dirty. #34

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

Open
311chaos opened this issue Jun 15, 2018 · 2 comments
Open

When using "push" and then "remove" the form stays dirty. #34

311chaos opened this issue Jun 15, 2018 · 2 comments

Comments

@311chaos
Copy link

Are you submitting a bug report or a feature request?

I believe this is a bug, but it is possible that I am not understanding something.

What is the current behavior?

When using a FieldArray, push, and remove you can end up with a dirty form, when I don't think it should be dirty.

I forked the Simple Demo: https://codesandbox.io/s/32p402x3om

  • Click Add Customer
  • Click the X to remove the just added field.

The form stays dirty, but I would expect it to be back to pristine.

What is the expected behavior?

  • I think the form should not be dirty, since you have undone the adding of a field (similar to typing in a text input, and then deleting the text)

Sandbox Link

https://codesandbox.io/s/32p402x3om

What's your environment?

React Final form. Mac OSX Chrome.

Other information

Thank you for a great library. Let me know if I can provide more information.

@maciejmyslinski
Copy link
Contributor

Howdy!

Thank you for reporting an issue! 👍

Could you please double check if the demo you provided works as you'd expect? I can't see add customer button anywhere 😞

Thanks!

@titenis
Copy link

titenis commented Aug 8, 2019

This bug still persist with versions:

"final-form": "4.18.2",
"final-form-arrays": "3.0.1",
"react-final-form": "6.3.0",
"react-final-form-arrays": "3.1.0",

on form.mutators.remove('emails', 0); second element becomes first one and becomes dirty, which is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants