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

Inserted / pushed ArrayField is not pristine #23

Closed
maciejmyslinski opened this issue Jan 28, 2019 · 1 comment
Closed

Inserted / pushed ArrayField is not pristine #23

maciejmyslinski opened this issue Jan 28, 2019 · 1 comment

Comments

@maciejmyslinski
Copy link

Are you submitting a bug report or a feature request?

bug report

What is the current behavior?

We have an array of fruits.
Initial values are: []

Steps to reproduce:
  1. click insert(0, '') or push('') button.

When an Array Field mounts for the first time with insert or push, it's NOT pristine.

What is the expected behavior?

When a normal Field mounts for the first time, it's pristine. I would expect every inserted or pushed input to be pristine as well.

Sandbox Link

Edit 🐛 Inserted/pushed ArrayField is not pristine

What's your environment?

package version
final-form 4.11
react-final-form 4.0.2
final-form-arrays 1.1.1
react-final-form-arrays 2.0.1

Other information

@erikras
Copy link
Member

erikras commented Jul 15, 2019

This is not really a bug. If you insert(0, undefined) or push(undefined), they are pristine. That's how non-array fields appear pristine on first render. The way final-form handles '' and undefined is complex and intentional.

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