File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
6565 const [ rootErrors , setRootErrors ] = useState < string [ ] > ( [ ] ) ;
6666 const [ errors , setErrors ] = useState < FormErrors < TData > > ( { } ) ;
6767 const [ values , setValues ] = useState < PartialFormDataType < TData > > ( { } ) ;
68+ const [ isInitialSetValuesComplete , setIsInitialSetValuesComplete ] = useState ( false ) ;
6869
6970 const handleError = ( error : z . ZodError < TData > ) => {
7071 const fieldErrors : FormErrors < TData > = { } ;
@@ -130,8 +131,13 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
130131 if ( initialValues ) {
131132 setValues ( getInitialValues ( initialValues ) ) ;
132133 }
134+ setIsInitialSetValuesComplete ( true ) ;
133135 } , [ initialValues ] ) ;
134136
137+ if ( ! isInitialSetValuesComplete ) {
138+ return null ;
139+ }
140+
135141 return (
136142 < form
137143 autoComplete = "off"
You can’t perform that action at this time.
0 commit comments