Skip to content

Commit df58c61

Browse files
authored
Fix potential validation paused bug (#237)
1 parent adf01fd commit df58c61

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"eslint-plugin-import": "^2.11.0",
4545
"eslint-plugin-jsx-a11y": "^6.0.2",
4646
"eslint-plugin-react": "^7.7.0",
47-
"final-form": "^4.6.0",
47+
"final-form": "^4.6.1",
4848
"flow-bin": "^0.70.0",
4949
"glow": "^1.2.2",
5050
"husky": "^0.14.3",
@@ -58,7 +58,7 @@
5858
"prop-types": "^15.6.1",
5959
"react": "^16.3.2",
6060
"react-dom": "^16.3.2",
61-
"rollup": "^0.58.1",
61+
"rollup": "^0.58.2",
6262
"rollup-plugin-babel": "^3.0.4",
6363
"rollup-plugin-commonjs": "^9.1.0",
6464
"rollup-plugin-flow": "^1.1.1",
@@ -69,7 +69,7 @@
6969
"typescript": "^2.8.1"
7070
},
7171
"peerDependencies": {
72-
"final-form": "^4.2.0",
72+
"final-form": "^4.6.1",
7373
"prop-types": "^15.6.0",
7474
"react": "^15.3.0 || ^16.0.0-0"
7575
},

src/ReactFinalForm.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default class ReactFinalForm extends React.Component<Props, State> {
4242
state: State
4343
form: FormApi
4444
mounted: boolean
45+
resumeValidation: ?boolean
4546
unsubscriptions: Unsubscribe[]
4647

4748
static childContextTypes = {
@@ -131,12 +132,13 @@ export default class ReactFinalForm extends React.Component<Props, State> {
131132

132133
componentWillUpdate() {
133134
if (this.form) {
135+
this.resumeValidation = !this.form.isValidationPaused()
134136
this.form.pauseValidation()
135137
}
136138
}
137139

138140
componentDidUpdate() {
139-
if (this.form) {
141+
if (this.form && this.resumeValidation) {
140142
this.form.resumeValidation()
141143
}
142144
}
@@ -153,10 +155,7 @@ export default class ReactFinalForm extends React.Component<Props, State> {
153155
if (this.props[key] === nextProps[key]) {
154156
return
155157
}
156-
// istanbul ignore next
157-
if (this.form.setConfig) {
158-
this.form.setConfig(key, nextProps[key])
159-
}
158+
this.form.setConfig(key, nextProps[key])
160159
}
161160
)
162161
// istanbul ignore next

0 commit comments

Comments
 (0)