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" ;
2
2
import validators from "../utils/validators" ;
3
3
import { slugifyFormID } from "../utils/schema" ;
4
4
@@ -107,9 +107,9 @@ export default {
107
107
} ) ;
108
108
}
109
109
110
- let handleErrors = errors => {
110
+ let handleErrors = ( errors ) => {
111
111
let fieldErrors = [ ] ;
112
- forEach ( errors , err => {
112
+ forEach ( arrayUniq ( errors ) , err => {
113
113
if ( isArray ( err ) && err . length > 0 ) {
114
114
fieldErrors = fieldErrors . concat ( err ) ;
115
115
} else if ( isString ( err ) ) {
@@ -139,7 +139,7 @@ export default {
139
139
if ( ! isFunction ( this . debouncedValidateFunc ) ) {
140
140
this . debouncedValidateFunc = debounce (
141
141
this . validate . bind ( this ) ,
142
- objGet ( this , "$parent.options. validateDebounceTime" , 500 )
142
+ objGet ( this . schema , "validateDebounceTime" , objGet ( this . formOptions , " validateDebounceTime", 500 ) )
143
143
) ;
144
144
}
145
145
this . debouncedValidateFunc ( ) ;
@@ -162,8 +162,8 @@ export default {
162
162
this . schema . onChanged . call ( this , this . model , newValue , oldValue , this . schema ) ;
163
163
}
164
164
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 ) {
167
167
this . debouncedValidate ( ) ;
168
168
} else {
169
169
this . validate ( ) ;
0 commit comments