Skip to content

Commit 435e785

Browse files
committed
fix: reset present values after all path mutation
1 parent 2cc0e99 commit 435e785

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/olive-zoos-explode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vee-validate': patch
3+
---
4+
5+
fix: reset present values after all path mutation

packages/vee-validate/src/useForm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,14 @@ export function useForm<
662662
function resetForm(resetState?: Partial<FormState<TValues>>) {
663663
const newValues = resetState?.values ? resetState.values : originalInitialValues.value;
664664
setInitialValues(newValues);
665-
setValues(newValues);
666665
mutateAllPathState(state => {
667666
state.validated = false;
668667
state.touched = resetState?.touched?.[state.path as Path<TValues>] || false;
669668

670669
setFieldValue(state.path as Path<TValues>, getFromPath(newValues, state.path), false);
671670
setFieldError(state.path as Path<TValues>, undefined);
672671
});
672+
setValues(newValues);
673673

674674
setErrors(resetState?.errors || {});
675675
submitCount.value = resetState?.submitCount || 0;

0 commit comments

Comments
 (0)