Skip to content

Field array modified value is never changed #53

Open
@tim-mccurrach

Description

@tim-mccurrach

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions