Skip to content

Commit c1c6f39

Browse files
committed
fix: unref initial values when initializing the form closes #4563
1 parent fe369f9 commit c1c6f39

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/tough-deers-crash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vee-validate': patch
3+
---
4+
5+
fix: unref initial values when initializing the form closes #4563

packages/vee-validate/src/useForm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ let FORM_COUNTER = 0;
9797
const PRIVATE_PATH_STATE_KEYS: (keyof PathState)[] = ['bails', 'fieldsCount', 'id', 'multiple', 'type', 'validate'];
9898

9999
function resolveInitialValues<TValues extends GenericObject = GenericObject>(opts?: FormOptions<TValues>): TValues {
100-
const providedValues = opts?.initialValues || {};
100+
const providedValues = toValue(opts?.initialValues || {});
101101
const schema = unref(opts?.validationSchema);
102102
if (schema && isTypedSchema(schema) && isCallable(schema.cast)) {
103103
return deepCopy(schema.cast(providedValues) || {});

0 commit comments

Comments
 (0)