@@ -830,7 +830,10 @@ export class FormStore {
830830 const changedFields = fields . filter ( ( { name : fieldName } ) =>
831831 containsNamePath ( namePathList , fieldName as InternalNamePath ) ,
832832 ) ;
833- onFieldsChange ( changedFields , fields ) ;
833+
834+ if ( changedFields . length ) {
835+ onFieldsChange ( changedFields , fields ) ;
836+ }
834837 }
835838 } ;
836839
@@ -856,6 +859,10 @@ export class FormStore {
856859 // Collect result in promise list
857860 const promiseList : Promise < FieldError > [ ] = [ ] ;
858861
862+ // We temp save the path which need trigger for `onFieldsChange`
863+ const TMP_SPLIT = String ( Date . now ( ) ) ;
864+ const validateNamePathList = new Set < string > ( ) ;
865+
859866 this . getFieldEntities ( true ) . forEach ( ( field : FieldEntity ) => {
860867 // Add field if not provide `nameList`
861868 if ( ! provideNameList ) {
@@ -883,6 +890,8 @@ export class FormStore {
883890 }
884891
885892 const fieldNamePath = field . getNamePath ( ) ;
893+ validateNamePathList . add ( fieldNamePath . join ( TMP_SPLIT ) ) ;
894+
886895 // Add field validate rule in to promise list
887896 if ( ! provideNameList || containsNamePath ( namePathList , fieldNamePath ) ) {
888897 const promise = field . validateRules ( {
@@ -961,7 +970,10 @@ export class FormStore {
961970 returnPromise . catch < ValidateErrorEntity > ( e => e ) ;
962971
963972 // `validating` changed. Trigger `onFieldsChange`
964- this . triggerOnFieldsChange ( namePathList ) ;
973+ const triggerNamePathList = namePathList . filter ( namePath =>
974+ validateNamePathList . has ( namePath . join ( TMP_SPLIT ) ) ,
975+ ) ;
976+ this . triggerOnFieldsChange ( triggerNamePathList ) ;
965977
966978 return returnPromise as Promise < Store > ;
967979 } ;
0 commit comments