react-final-form-arrays icon indicating copy to clipboard operation
react-final-form-arrays copied to clipboard

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

Open 311chaos opened this issue 7 years ago • 2 comments

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.

311chaos avatar Jun 15 '18 17:06 311chaos

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!

maciejmyslinski avatar Sep 15 '18 15:09 maciejmyslinski

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

titenis avatar Aug 08 '19 09:08 titenis