File tree Expand file tree Collapse file tree
packages/vee-validate/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ export function useField<TValue = unknown>(
123123 bails,
124124 } ) ;
125125 } else {
126- result = ( await form . validateSchema ( ) ) [ unref ( name ) ] ;
126+ result = ( await form . validateSchema ( ) ) [ unref ( name ) ] ?? { valid : true , errors : [ ] } ;
127127 }
128128
129129 meta . pending = false ;
Original file line number Diff line number Diff line change @@ -521,16 +521,16 @@ async function validateYupSchema<TValues>(
521521 return err . inner || [ ] ;
522522 } ) ;
523523
524- const fields = form . fieldsById . value ;
524+ const fieldsById = form . fieldsById . value || { } ;
525525 const errorsByPath = errors . reduce ( ( acc , err ) => {
526526 acc [ err . path as keyof TValues ] = err ;
527527
528528 return acc ;
529529 } , { } as Record < keyof TValues , ValidationError > ) ;
530530
531531 // Aggregates the validation result
532- const aggregatedResult = keysOf ( fields ) . reduce ( ( result : Record < keyof TValues , ValidationResult > , fieldId ) => {
533- const field : PrivateFieldComposite | PrivateFieldComposite [ ] = fields [ fieldId ] ;
532+ const aggregatedResult = keysOf ( fieldsById ) . reduce ( ( result : Record < keyof TValues , ValidationResult > , fieldId ) => {
533+ const field : PrivateFieldComposite | PrivateFieldComposite [ ] = fieldsById [ fieldId ] ;
534534 const messages = ( errorsByPath [ fieldId ] || { errors : [ ] } ) . errors ;
535535 const fieldResult = {
536536 errors : messages ,
You can’t perform that action at this time.
0 commit comments