Skip to content

Commit

Permalink
fix: make sure to have a fallback for undefined casts closes #4186
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Mar 12, 2023
1 parent 5109100 commit 9f1c63b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function resolveInitialValues<TValues extends GenericFormValues = GenericFormVal
): TValues {
const providedValues = unref(opts?.initialValues) || {};
if (opts?.validationSchema && isTypedSchema(opts.validationSchema) && isCallable(opts.validationSchema.cast)) {
return deepCopy(opts.validationSchema.cast(providedValues));
return deepCopy(opts.validationSchema.cast(providedValues) || {});
}

return deepCopy(providedValues) as TValues;
Expand Down

0 comments on commit 9f1c63b

Please sign in to comment.