Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: avoid watching values at the end of reset calls closes #3407
  • Loading branch information
logaretm committed Jul 20, 2021
1 parent 2fd612b commit 86f594f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vee-validate/src/useField.ts
Expand Up @@ -10,6 +10,7 @@ import {
WatchStopHandle,
provide,
Ref,
nextTick,
} from 'vue';
import { BaseSchema } from 'yup';
import isEqual from 'fast-deep-equal/es6';
Expand Down Expand Up @@ -193,7 +194,10 @@ export function useField<TValue = unknown>(
function resetField(state?: Partial<FieldState<TValue>>) {
unwatchValue?.();
resetValidationState(state);
watchValue();
// need to watch at next tick to avoid triggering the value watcher
nextTick(() => {
watchValue();
});
}

const field: PrivateFieldComposite<TValue> = {
Expand Down

0 comments on commit 86f594f

Please sign in to comment.