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

The useField's syncVModel option does not work #4163

Closed
1 of 5 tasks
Dunqing opened this issue Feb 25, 2023 · 1 comment
Closed
1 of 5 tasks

The useField's syncVModel option does not work #4163

Dunqing opened this issue Feb 25, 2023 · 1 comment
Labels
🐛 bug Unintended behavior ☔ has workaround this issue has a workaround

Comments

@Dunqing
Copy link
Contributor

Dunqing commented Feb 25, 2023

What happened?

useFields is not synchronized with modelValue when it is initialized for the first time.

Reproduction steps

You can see the value default value is test, but the input value is empty.

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-radio-7meypq?file=src%2FInput.vue,src%2FApp.vue

Code of Conduct

@logaretm logaretm added the 🐛 bug Unintended behavior label Feb 26, 2023
@logaretm
Copy link
Owner

Thanks for reporting this, a workaround for now is to initialize it yourself temporarily till it is fixed.

const { value } = useField('test', undefined, {
  initialValue: props.modelValue,
  syncVModel: true,
});

@logaretm logaretm added the ☔ has workaround this issue has a workaround label Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unintended behavior ☔ has workaround this issue has a workaround
Projects
None yet
Development

No branches or pull requests

2 participants