Skip to content

Commit 8e3663d

Browse files
committed
fix: properly unref the schema before checking for default values closes #4196
1 parent 8fb543a commit 8e3663d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/vee-validate/src/useForm.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ function resolveInitialValues<TValues extends GenericFormValues = GenericFormVal
8181
opts?: FormOptions<TValues>
8282
): TValues {
8383
const providedValues = unref(opts?.initialValues) || {};
84-
if (opts?.validationSchema && isTypedSchema(opts.validationSchema) && isCallable(opts.validationSchema.cast)) {
85-
return deepCopy(opts.validationSchema.cast(providedValues) || {});
84+
const schema = unref(opts?.validationSchema);
85+
if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
86+
return deepCopy(schema.cast(providedValues) || {});
8687
}
8788

8889
return deepCopy(providedValues) as TValues;

0 commit comments

Comments
 (0)