File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1048,3 +1048,33 @@ describe("ReactFinalForm", () => {
10481048 expect ( calls [ calls . length - 1 ] ) . toBe ( false ) ;
10491049 } ) ;
10501050} ) ;
1051+
1052+ describe ( "Issue #914 – nested Field with validator causing Maximum update depth" , ( ) => {
1053+ it ( "should not throw Maximum update depth exceeded when nesting Fields with validators" , ( ) => {
1054+ // https://github.com/final-form/react-final-form/issues/914
1055+ const required = ( value ) => ( value ? undefined : "Required" ) ;
1056+
1057+ expect ( ( ) => {
1058+ render (
1059+ < Form onSubmit = { onSubmitMock } >
1060+ { ( { handleSubmit } ) => (
1061+ < form onSubmit = { handleSubmit } >
1062+ < Field name = "outer" validate = { required } >
1063+ { ( { input } ) => (
1064+ < div >
1065+ < input { ...input } data-testid = "outer" />
1066+ < Field name = "inner" validate = { required } >
1067+ { ( { input : innerInput } ) => (
1068+ < input { ...innerInput } data-testid = "inner" />
1069+ ) }
1070+ </ Field >
1071+ </ div >
1072+ ) }
1073+ </ Field >
1074+ </ form >
1075+ ) }
1076+ </ Form > ,
1077+ ) ;
1078+ } ) . not . toThrow ( ) ;
1079+ } ) ;
1080+ } ) ;
You can’t perform that action at this time.
0 commit comments