Skip to content

Commit

Permalink
fix: properly initialize initial values closes #2978
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Oct 15, 2020
1 parent 48fd085 commit c0ba699
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,11 @@ function useFormInitialValues(
providedValues?: MaybeReactive<Record<string, any>>
) {
const initialValues = computed<Record<string, any>>(() => {
const values = providedValues?.value || {};
if (isRef(values)) {
return values.value as Record<string, any>;
if (isRef(providedValues)) {
return providedValues.value as Record<string, any>;
}

return values;
return providedValues || {};
});

// Watch initial values for changes, and update the pristine (non-dirty and non-touched fields)
Expand Down

0 comments on commit c0ba699

Please sign in to comment.