@@ -83,25 +83,28 @@ export const useAugmentedForm = <RecordType = any>(
8383 } ) ;
8484
8585 const formRef = useRef ( form ) ;
86- const { reset } = form ;
86+ const { reset, formState } = form ;
87+ const { isReady } = formState ;
8788
8889 useEffect ( ( ) => {
90+ if ( ! isReady ) return ;
8991 reset ( defaultValuesIncludingRecord ) ;
90- } , [ defaultValuesIncludingRecord , reset ] ) ;
92+ } , [ defaultValuesIncludingRecord , reset , isReady ] ) ;
9193
9294 // notify on invalid form
9395 useNotifyIsFormInvalid ( form . control , ! disableInvalidFormNotification ) ;
9496
9597 const recordFromLocation = useRecordFromLocation ( ) ;
9698 const recordFromLocationApplied = useRef ( false ) ;
9799 useEffect ( ( ) => {
100+ if ( ! isReady ) return ;
98101 if ( recordFromLocation && ! recordFromLocationApplied . current ) {
99102 reset ( merge ( { } , defaultValuesIncludingRecord , recordFromLocation ) , {
100103 keepDefaultValues : true ,
101104 } ) ;
102105 recordFromLocationApplied . current = true ;
103106 }
104- } , [ defaultValuesIncludingRecord , recordFromLocation , reset ] ) ;
107+ } , [ defaultValuesIncludingRecord , recordFromLocation , reset , isReady ] ) ;
105108
106109 // submit callbacks
107110 const handleSubmit = useCallback (
0 commit comments