Skip to content

Commit

Permalink
fix: make sure to deep watch created models by useFieldModel
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Aug 7, 2022
1 parent bd8b4e0 commit fbe273c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/vee-validate/src/useForm.ts
Expand Up @@ -291,11 +291,17 @@ 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, () => {
if (!fieldExists(unref(path as string))) {
validate({ mode: 'validated-only' });
watch(
value,
() => {
if (!fieldExists(unref(path as string))) {
validate({ mode: 'validated-only' });
}
},
{
deep: true,
}
});
);

return value;
}
Expand Down

0 comments on commit fbe273c

Please sign in to comment.