Skip to content

Commit

Permalink
fix: unref initial values when initializing the form closes #4563
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Nov 28, 2023
1 parent fe369f9 commit c1c6f39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tough-deers-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vee-validate': patch
---

fix: unref initial values when initializing the form closes #4563
2 changes: 1 addition & 1 deletion packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let FORM_COUNTER = 0;
const PRIVATE_PATH_STATE_KEYS: (keyof PathState)[] = ['bails', 'fieldsCount', 'id', 'multiple', 'type', 'validate'];

function resolveInitialValues<TValues extends GenericObject = GenericObject>(opts?: FormOptions<TValues>): TValues {
const providedValues = opts?.initialValues || {};
const providedValues = toValue(opts?.initialValues || {});
const schema = unref(opts?.validationSchema);
if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
return deepCopy(schema.cast(providedValues) || {});
Expand Down

0 comments on commit c1c6f39

Please sign in to comment.