Skip to content

Commit

Permalink
fix: properly unref the schema before checking for default values closes
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Mar 23, 2023
1 parent 8fb543a commit 8e3663d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ function resolveInitialValues<TValues extends GenericFormValues = GenericFormVal
opts?: FormOptions<TValues>
): TValues {
const providedValues = unref(opts?.initialValues) || {};
if (opts?.validationSchema && isTypedSchema(opts.validationSchema) && isCallable(opts.validationSchema.cast)) {
return deepCopy(opts.validationSchema.cast(providedValues) || {});
const schema = unref(opts?.validationSchema);
if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
return deepCopy(schema.cast(providedValues) || {});
}

return deepCopy(providedValues) as TValues;
Expand Down

0 comments on commit 8e3663d

Please sign in to comment.