File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -991,3 +991,33 @@ describe("ReactFinalForm", () => {
991991 expect ( getByTestId ( "password" ) . value ) . toBe ( "f1nal-f0rm-RULEZ" ) ;
992992 } ) ;
993993} ) ;
994+
995+ describe ( "Issue #914 – nested Field with validator causing Maximum update depth" , ( ) => {
996+ it ( "should not throw Maximum update depth exceeded when nesting Fields with validators" , ( ) => {
997+ // https://github.com/final-form/react-final-form/issues/914
998+ const required = ( value ) => ( value ? undefined : "Required" ) ;
999+
1000+ expect ( ( ) => {
1001+ render (
1002+ < Form onSubmit = { onSubmitMock } >
1003+ { ( { handleSubmit } ) => (
1004+ < form onSubmit = { handleSubmit } >
1005+ < Field name = "outer" validate = { required } >
1006+ { ( { input } ) => (
1007+ < div >
1008+ < input { ...input } data-testid = "outer" />
1009+ < Field name = "inner" validate = { required } >
1010+ { ( { input : innerInput } ) => (
1011+ < input { ...innerInput } data-testid = "inner" />
1012+ ) }
1013+ </ Field >
1014+ </ div >
1015+ ) }
1016+ </ Field >
1017+ </ form >
1018+ ) }
1019+ </ Form > ,
1020+ ) ;
1021+ } ) . not . toThrow ( ) ;
1022+ } ) ;
1023+ } ) ;
You can’t perform that action at this time.
0 commit comments