Fix `component[Will|Did]Update` behavior. Build release.

This commit is contained in:
Semigradsky 2015-12-02 16:50:06 +03:00
parent 7481b6da64
commit c4fa202ebf
3 changed files with 6 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -74,11 +74,9 @@ Formsy.Form = React.createClass({
},
componentWillUpdate: function () {
// Keep a reference to input keys before form updates,
// Keep a reference to input names before form updates,
// to check if inputs has changed after render
this.prevInputKeys = Object.keys(this.inputs);
this.prevInputNames = this.inputs.map(component => component.props.name);
},
componentDidUpdate: function () {
@ -87,8 +85,8 @@ Formsy.Form = React.createClass({
this.setInputValidationErrors(this.props.validationErrors);
}
var newInputKeys = Object.keys(this.inputs);
if (utils.arraysDiffer(this.prevInputKeys, newInputKeys)) {
var newInputNames = this.inputs.map(component => component.props.name);
if (utils.arraysDiffer(this.prevInputNames, newInputNames)) {
this.validateForm();
}