File tree 3 files changed +6
-5
lines changed
3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,9 @@ function toErrorSchema(errors) {
70
70
// "errors" (see `validate.createErrorHandler`).
71
71
parent . __errors = parent . __errors . concat ( message ) ;
72
72
} else {
73
- parent . __errors = [ message ] ;
73
+ if ( message ) {
74
+ parent . __errors = [ message ] ;
75
+ }
74
76
}
75
77
return errorSchema ;
76
78
} , { } ) ;
@@ -201,7 +203,6 @@ export default function validateFormData(
201
203
errors = transformErrors ( errors ) ;
202
204
}
203
205
const errorSchema = toErrorSchema ( errors ) ;
204
-
205
206
if ( typeof customValidate !== "function" ) {
206
207
return { errors, errorSchema } ;
207
208
}
Original file line number Diff line number Diff line change @@ -1995,7 +1995,7 @@ describe("Form", () => {
1995
1995
1996
1996
const { comp } = createFormComponent ( formProps ) ;
1997
1997
1998
- expect ( comp . state . errorSchema ) . eql ( { __errors : [ undefined ] } ) ;
1998
+ expect ( comp . state . errorSchema ) . eql ( { } ) ;
1999
1999
2000
2000
setProps ( comp , {
2001
2001
...formProps ,
@@ -2013,7 +2013,7 @@ describe("Form", () => {
2013
2013
2014
2014
setProps ( comp , formProps ) ;
2015
2015
2016
- expect ( comp . state . errorSchema ) . eql ( { __errors : [ undefined ] } ) ;
2016
+ expect ( comp . state . errorSchema ) . eql ( { } ) ;
2017
2017
} ) ;
2018
2018
} ) ;
2019
2019
} ) ;
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ describe("Validation", () => {
131
131
stack : errMessage ,
132
132
} ,
133
133
] ) ;
134
- expect ( errors . errorSchema ) . to . eql ( { __errors : [ undefined ] } ) ;
134
+ expect ( errors . errorSchema ) . to . eql ( { } ) ;
135
135
} ) ;
136
136
it ( "should return a validation error about formData" , ( ) => {
137
137
const errors = validateFormData (
You can’t perform that action at this time.
0 commit comments