Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useForm with schema and reactive initialValues behave differently on update #4347

Closed
2 of 5 tasks
anton-muraviov-confetti opened this issue Jul 4, 2023 · 1 comment
Closed
2 of 5 tasks
Labels
🐛 bug Unintended behavior

Comments

@anton-muraviov-confetti
Copy link

anton-muraviov-confetti commented Jul 4, 2023

What happened?

on initial render the initialValues are passed through schema.cast
https://github.com/logaretm/vee-validate/blob/v4.10.5/packages/vee-validate/src/useForm.ts#L102
and on updates of initialValues it does not, resulting in different initialValues state
https://github.com/logaretm/vee-validate/blob/v4.10.5/packages/vee-validate/src/useForm.ts#L1077C17-L1077C17

Reproduction steps

  1. run stackblitz
  2. click test
  3. see form is now dirty because the initial values were not passed through schema.cast

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

https://stackblitz.com/edit/vee-validate-v4-starter-composition-example-gp2dxq?file=src%2FApp.vue

Code of Conduct

@logaretm logaretm added the 🐛 bug Unintended behavior label Jul 6, 2023
@logaretm
Copy link
Owner

logaretm commented Jul 6, 2023

Thanks for reporting this, this is indeed a bug. However even with the fix you will still need to not use initialValues.value = to reset. Use resetForm instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants