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

update fields issue in reduxForm HOC #507

Closed
jsdmc opened this issue Jan 6, 2016 · 3 comments
Closed

update fields issue in reduxForm HOC #507

jsdmc opened this issue Jan 6, 2016 · 3 comments

Comments

@jsdmc
Copy link
Contributor

jsdmc commented Jan 6, 2016

Scenario
I have a form with some field initialized with value 0. This field is binded to text input. When I try to remove value - actual field value becomes "", but in text input it still 0.

Issue
Here https://github.com/erikras/redux-form/blob/master/src/createHigherOrderComponent.js#L45 in second comparison we have a problem because by default 'deep-equal' module uses non strict comparison and thus we skip updating for fields values (but in state they are updated)

javascript
componentWillReceiveProps(nextProps) {
if (!deepEqual(this.props.fields, nextProps.fields) || !deepEqual(this.props.form, nextProps.form)) {
this.fields = readFields(nextProps, this.props, this.fields, this.asyncValidate, isReactNative);
}
...
}


Solution is quite easy, we just need to pass parameters for comparison

``` javascript```
deepEqual(this.props.form, nextProps.form, { strict: true })
@jsdmc
Copy link
Contributor Author

jsdmc commented Jan 6, 2016

PR #508

@erikras erikras closed this as completed in 0b38ef1 Jan 6, 2016
erikras added a commit that referenced this issue Jan 6, 2016
@erikras
Copy link
Member

erikras commented Jan 7, 2016

Fix published in v4.1.1.

@lock
Copy link

lock bot commented Jun 3, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants