Skip to content

move and swap only affect values, not field state #10

Closed
@dallonf

Description

@dallonf

Are you submitting a bug report or a feature request?

I believe this is a bug.

What is the current behavior?

Here is a version of of the React Final Form Arrays example, modified to have validation errors that only appear when a field has been touched:

https://codesandbox.io/s/8k623wrrz9

  1. Click "Add Customer"
  2. Click in the "First Name" field, type something in (ex. "Homer")
  3. Click in the "Last Name" field, but do not type in it
  4. Click "Add Customer" again (Red text "Required" will appear under Customer 1's Last Name)
  5. Click in Customer 2's "First Name" field, type something different (ex. "Marge")
  6. Do not click in Customer 2's "Last Name" field.
  7. Click the "Swap first two" button

The names have changed, but the "Required" error message is still in the same place (or, depending on your perspective, has moved to a different customer).

What is the expected behavior?

I would expect the "touched" state to move along with the field, so that in this example the error would still be attached to Homer's last name, even though Homer has moved.

What's your environment?

  • final-form-arrays@1.0.4
  • final-form@4.8.2
  • react-final-form@3.6.2
  • Chrome 67.0.3396.99
  • macOS Sierra (10.12.6)

Other information

The demo shows this happening with swap, but I originally observed the behavior with move.

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