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

Field array modified value is never changed #53

Open
tim-mccurrach opened this issue May 21, 2020 · 1 comment
Open

Field array modified value is never changed #53

tim-mccurrach opened this issue May 21, 2020 · 1 comment

Comments

@tim-mccurrach
Copy link

Are you submitting a bug report or a feature request?

Bug report - I think

What is the current / expected behaviour?

Using any of the array mutators does not change the modified value of the value array. I would expect modified to be true after adding to, removing from, or changing the order of an array. As things stand, I don't think the modified value of a field array will ever change (although pristine and dirty do).

There is a slight question mark in my mind whether using update for example should affect the modified value of the field array. The 'child' field will definitely have been modified, but it's not obvious that this means you would say the 'parent' field is modified. I'm edging towards not. But would appreciate any thoughts on this.

Sandbox Link

https://codesandbox.io/s/kx8qv67nk5

  1. Add Customers
  2. Observe the value of modified via in the state for customers
  3. It remains false

What's your environment?

final-form: 4.12.0,
final-form-arrays: 1.1.2,
react-final-form: 4.1.0,
react-final-form-arrays: 2.0.3,
react: 16.8.6

Solution

There is an easy fix for this, which is to set the modified value for the field to true in the mutators. I am happy to put in a PR for this and update tests etc, but thought I would check that what I would expect the behaviour is infact the desired behaviour.

Other information

There is also currently a bug where the modified value is not rest on form reset here. As far as I can tell, this issue is largely unrelated, but I mention it because there is a chance of some overlap.

@jwld
Copy link

jwld commented Apr 20, 2024

Just encountered this, seems to still be the case.

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