Skip to content

Commit fbe273c

Browse files
committed
fix: make sure to deep watch created models by useFieldModel
1 parent bd8b4e0 commit fbe273c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/vee-validate/src/useForm.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,17 @@ export function useForm<TValues extends Record<string, any> = Record<string, any
291291

292292
function createModel<TPath extends keyof TValues>(path: MaybeRef<TPath>) {
293293
const { value } = _useFieldValue<TValues[TPath]>(path as string);
294-
watch(value, () => {
295-
if (!fieldExists(unref(path as string))) {
296-
validate({ mode: 'validated-only' });
294+
watch(
295+
value,
296+
() => {
297+
if (!fieldExists(unref(path as string))) {
298+
validate({ mode: 'validated-only' });
299+
}
300+
},
301+
{
302+
deep: true,
297303
}
298-
});
304+
);
299305

300306
return value;
301307
}

0 commit comments

Comments
 (0)