Skip to content

FieldArray becomes permanently dirty on change #37

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
anant-singh opened this issue Aug 29, 2018 · 2 comments
Open

FieldArray becomes permanently dirty on change #37

anant-singh opened this issue Aug 29, 2018 · 2 comments

Comments

@anant-singh
Copy link

Are you submitting a bug report or a feature request?

Bug

What is the current behavior?

If I change any field in a FieldArray, the state of the parent FieldArray changes to dirty and stays dirty even after reverting to the original state.

What is the expected behavior?

The top level FieldArray should revert to pristine state if the fields are returned to their original state.

Sandbox Link

I'd be happy to provide one if needed.

What's your environment?

  • final-form: 4.9.1
  • react-final-form: 3.6.5
  • final-form-arrays: 1.1.0
  • react-final-form-arrays: 1.0.6
  • React: 16.4.1

Other information

https://github.com./final-form/react-final-form-arrays/blob/master/src/FieldArray.js#L78

Looking at where the FieldArray is registered, I see there is no equality comparator passed which would mean it defaults to a === check which would fail for an array.

I added a small snippet to enable addition of custom field level comparator to compare the arrays in my fork here: https://github.com./anant-singh/react-final-form-arrays/blob/dirty-field-check/src/FieldArray.js#L69-L88

@JasonTheAdams
Copy link

We are having an issue with this as well. This bug is very old. Any intentions to fix this @erikras?

@JasonTheAdams
Copy link

I'm really wondering if this is related to final-form/react-final-form#709 wherein the underlying useField hook is no longer providing updated meta for sub-fields. The issue is regarding meta.active, but it's actually all meta data.

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

2 participants