Skip to content

Commit a09a879

Browse files
loadchangee1emeb0t
authored andcommitted
fix: Closes #825
1 parent 7d618d7 commit a09a879

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/form/Form.jsx

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ export default class Form extends Component {
1818
}
1919
}
2020

21+
componentDidUpdate(newProps: Object): void {
22+
const {model} = newProps
23+
const oldModel = this.props.model
24+
if (!model) return
25+
const diff = Object.keys(model).filter(key => model[key] !== oldModel[key])
26+
if (diff.length) {
27+
this.state.fields.filter(({props}) => props.prop.match(diff))
28+
.map(field => field.validate('', () => undefined));
29+
}
30+
}
31+
2132
getChildContext(): { component: Form } {
2233
return {
2334
component: this

0 commit comments

Comments
 (0)