1- import { get as objGet , forEach , isFunction , isString , isArray , debounce , uniqueId } from "lodash" ;
1+ import { get as objGet , forEach , isFunction , isString , isArray , debounce , uniqueId , uniq as arrayUniq } from "lodash" ;
22import validators from "../utils/validators" ;
33import { slugifyFormID } from "../utils/schema" ;
44
@@ -107,9 +107,9 @@ export default {
107107 } ) ;
108108 }
109109
110- let handleErrors = errors => {
110+ let handleErrors = ( errors ) => {
111111 let fieldErrors = [ ] ;
112- forEach ( errors , err => {
112+ forEach ( arrayUniq ( errors ) , err => {
113113 if ( isArray ( err ) && err . length > 0 ) {
114114 fieldErrors = fieldErrors . concat ( err ) ;
115115 } else if ( isString ( err ) ) {
@@ -139,7 +139,7 @@ export default {
139139 if ( ! isFunction ( this . debouncedValidateFunc ) ) {
140140 this . debouncedValidateFunc = debounce (
141141 this . validate . bind ( this ) ,
142- objGet ( this , "$parent.options. validateDebounceTime" , 500 )
142+ objGet ( this . schema , "validateDebounceTime" , objGet ( this . formOptions , " validateDebounceTime", 500 ) )
143143 ) ;
144144 }
145145 this . debouncedValidateFunc ( ) ;
@@ -162,8 +162,8 @@ export default {
162162 this . schema . onChanged . call ( this , this . model , newValue , oldValue , this . schema ) ;
163163 }
164164
165- if ( objGet ( this . $parent , "options. validateAfterChanged" , false ) === true ) {
166- if ( objGet ( this . $parent , "options. validateDebounceTime" , 0 ) > 0 ) {
165+ if ( objGet ( this . formOptions , "validateAfterChanged" , false ) === true ) {
166+ if ( objGet ( this . schema , "validateDebounceTime" , objGet ( this . formOptions , " validateDebounceTime", 0 ) ) > 0 ) {
167167 this . debouncedValidate ( ) ;
168168 } else {
169169 this . validate ( ) ;
0 commit comments