Skip to content

Commit

Permalink
fix: avoid validating when field instance exists
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed May 13, 2022
1 parent 26c828e commit 3759df2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vee-validate/src/useForm.ts
Expand Up @@ -288,7 +288,11 @@ export function useForm<TValues extends Record<string, any> = Record<string, any

function createModel<TPath extends keyof TValues>(path: MaybeRef<TPath>) {
const { value } = _useFieldValue<TValues[TPath]>(path as string);
watch(value, () => validate({ mode: 'validated-only' }));
watch(value, () => {
if (!fieldExists(unref(path as string))) {
validate({ mode: 'validated-only' });
}
});

return value;
}
Expand Down

0 comments on commit 3759df2

Please sign in to comment.