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
Initialize with keepDirty and empty array creates an empty object in form values #3095
Comments
percevalw
added a commit
to percevalw/redux-form
that referenced
this issue
Jun 24, 2017
percevalw
added a commit
to percevalw/redux-form
that referenced
this issue
Jun 24, 2017
Fix published in |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
Hi, I'm working on an array structure form. When I delete a field in the array list that was before set to a 'empty-like' value
{name: ""}
, and triggers initialize with keepDirty option and an new empty initial value to make it pristine, the ReduxForm reducer creates an empty object in the state values.What is the expected behavior?
The values array should not be altered by the reducer as the keepDirty parameter is set to true and the field indeed dirty.
Sandbox Link
https://www.webpackbin.com/bins/-KnHcmQvY3yKJ4ZF8m0C
What's your environment?
Any environment
Other information
In the
createReducer/js
file :The deepEqual function is guilty in part, because it considers
[{name: ''}]
and[]
equals regarding themyList.0.name
field. Therefore, since the old value is equal to the old initial value, it sets the new value equal to the new initial value to keep it pristine, which creates an empty object to set the0.name
property to undefined.The text was updated successfully, but these errors were encountered: