@@ -309,6 +309,7 @@ export function useForm<
309309 multiple : false ,
310310 __flags : {
311311 pendingUnmount : { [ id ] : false } ,
312+ pendingReset : false ,
312313 } ,
313314 fieldsCount : 1 ,
314315 validate : config ?. validate ,
@@ -733,11 +734,21 @@ export function useForm<
733734
734735 function resetField ( field : Path < TValues > , state ?: Partial < FieldState > ) {
735736 const newValue = state && 'value' in state ? state . value : getFromPath ( initialValues . value , field ) ;
737+ const pathState = findPathState ( field ) ;
738+ if ( pathState ) {
739+ pathState . __flags . pendingReset = true ;
740+ }
736741
737742 setFieldInitialValue ( field , deepCopy ( newValue ) ) ;
738743 setFieldValue ( field , newValue as PathValue < TValues , typeof field > , false ) ;
739744 setFieldTouched ( field , state ?. touched ?? false ) ;
740745 setFieldError ( field , state ?. errors || [ ] ) ;
746+
747+ nextTick ( ( ) => {
748+ if ( pathState ) {
749+ pathState . __flags . pendingReset = false ;
750+ }
751+ } ) ;
741752 }
742753
743754 /**
@@ -748,6 +759,7 @@ export function useForm<
748759 newValues = isTypedSchema ( schema ) && isCallable ( schema . cast ) ? schema . cast ( newValues ) : newValues ;
749760 setInitialValues ( newValues ) ;
750761 mutateAllPathState ( state => {
762+ state . __flags . pendingReset = true ;
751763 state . validated = false ;
752764 state . touched = resetState ?. touched ?. [ state . path as Path < TValues > ] || false ;
753765
@@ -760,6 +772,10 @@ export function useForm<
760772 submitCount . value = resetState ?. submitCount || 0 ;
761773 nextTick ( ( ) => {
762774 validate ( { mode : 'silent' } ) ;
775+
776+ mutateAllPathState ( state => {
777+ state . __flags . pendingReset = false ;
778+ } ) ;
763779 } ) ;
764780 }
765781
0 commit comments