vee-validate icon indicating copy to clipboard operation
vee-validate copied to clipboard

form values will be covered by the `initialValue` value of `usefield`

Open byronogis opened this issue 1 year ago • 1 comments

What happened?

// component A
// there is already have a form (by useForm), 
const {
  values,
  setValues,
} = useForm()

// and then use setValues to set a new value, 
setValues({
  name: 'x',
})

// component B
// create a new field (by useField, and have a avaliable initialValue y)
const {
  value
} = useField('name', undefined, {
  initialValue: 'y'
})

when the compoent B is dynamic create, the name will y not x

"vee-validate": "^4.13.2",
"vue": "^3.3.11",

Reproduction steps

See https://stackblitz.com/edit/puuk1z-imn8wg?file=src%2FApp.vue,src%2FInputText.vue&startScript=dev

Version

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

What browsers are you seeing the problem on?

  • [ ] Firefox
  • [X] Chrome
  • [ ] Safari
  • [ ] Microsoft Edge

Relevant log output

No response

Demo link

https://stackblitz.com/edit/puuk1z-imn8wg?file=src%2FApp.vue,src%2FInputText.vue&startScript=dev

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

byronogis avatar Aug 26 '24 11:08 byronogis