Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 05764e4

Browse files
authored
Merge pull request #983 from TLadd/trl/prevent-validation-object-keys-undefined
Fix bug with validation on change where Object.keys called on undefined
2 parents 4c32d78 + a0ebab3 commit 05764e4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/reducers/form-actions-reducer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,9 @@ export function createFormActionsReducer(options) {
368368
// If the form is invalid (due to async validity)
369369
// but its fields are valid and the value has changed,
370370
// the form should be "valid" again.
371-
const validityIsBool = typeof parentForm.$form.validity === 'boolean';
372-
const isInvalid = validityIsBool
373-
? !parentForm.$form.validity
374-
: !Object.keys(parentForm.$form.validity).length;
375-
if (isInvalid
371+
if ((!parentForm.$form.validity
372+
|| typeof parentForm.$form.validity === 'boolean'
373+
|| !Object.keys(parentForm.$form.validity).length)
376374
&& !parentForm.$form.valid
377375
&& isValid(parentForm, { async: false })) {
378376
return {

0 commit comments

Comments
 (0)