@@ -251,7 +251,7 @@ const createManagerApi: CreateManagerApi = ({
251
251
let runFormValidation = false ;
252
252
let revalidatedFields : Array < string > = [ ] ;
253
253
let registeringField : string | number | undefined ;
254
- let isSilent = false ;
254
+ let isSilent = 0 ;
255
255
let silentRender : string [ ] = [ ] ;
256
256
let runningValidators = 0 ;
257
257
let flatSubmitErrors : AnyObject = { } ;
@@ -528,7 +528,7 @@ const createManagerApi: CreateManagerApi = ({
528
528
return ( subscribeTo : Array < string > = [ ] ) => {
529
529
const changedAttributes = [ ...findDifference ( snapshot , state ) , ...subscribeTo ] ;
530
530
531
- if ( isSilent ) {
531
+ if ( isSilent > 0 ) {
532
532
changedAttributes . forEach ( ( attr ) => addIfUnique ( silentRender , attr ) ) ;
533
533
} else if ( changedAttributes . length > 0 ) {
534
534
rerender ( changedAttributes ) ;
@@ -745,7 +745,7 @@ const createManagerApi: CreateManagerApi = ({
745
745
}
746
746
747
747
function registerField ( field : FieldConfig ) : void {
748
- isSilent = ! ! field . silent ;
748
+ isSilent = field . silent ? isSilent + 1 : isSilent ;
749
749
registeringField = field . internalId || field . name ;
750
750
batch ( ( ) => {
751
751
const render = prepareRerender ( ) ;
@@ -799,18 +799,18 @@ const createManagerApi: CreateManagerApi = ({
799
799
800
800
render ( ) ;
801
801
} ) ;
802
- isSilent = false ;
802
+ isSilent = field . silent ? Math . min ( isSilent - 1 , 0 ) : isSilent ;
803
803
registeringField = undefined ;
804
804
}
805
805
806
806
function afterSilentRegistration ( field : Omit < FieldConfig , 'render' > ) {
807
- revalidateFields ( [ field . name , ...( state . fieldListeners [ field . name ] ?. validateFields || state . registeredFields . filter ( ( n ) => n !== field . name ) ) ] ) ;
807
+ if ( isSilent === 0 && silentRender . length > 0 ) {
808
+ revalidateFields ( [ field . name , ...( state . fieldListeners [ field . name ] ?. validateFields || state . registeredFields . filter ( ( n ) => n !== field . name ) ) ] ) ;
808
809
809
- if ( config . validate ) {
810
- validateForm ( config . validate ) ;
811
- }
810
+ if ( config . validate ) {
811
+ validateForm ( config . validate ) ;
812
+ }
812
813
813
- if ( silentRender . length > 0 ) {
814
814
registeringField = field . internalId || field . name ;
815
815
rerender ( silentRender ) ;
816
816
silentRender = [ ] ;
0 commit comments