question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useVuelidate breaks reactivity connection of object returned by a toRefs

See original GitHub issue

The codesandbox won’t compile due to some error with vue-demi, but I hope you can get the gist. Providing an object obtained via toRefs into useVuelidate will break the connection between the original state and the generated refs. Was pretty painful to debug.

If the refs object is denstructured, everything works as expected. I tried to look into the source code, but could not understand where the problem lies

https://codesandbox.io/s/brave-raman-fex90?file=/src/App.vue

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dobromir-hristovcommented, Feb 18, 2021

Yeah… We have the main ways working, so I think that’s good for now

0reactions
IlCallocommented, Feb 18, 2021

I see, I was reading there instead: https://vuelidate-next.netlify.app/advanced_usage.html#composition-api But I see you just updated that page too to show the reactive state usage.

The highlighted problem still holds btw, but I guess it’s intended behaviour or we’re in “won’t fix” realm

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue.js - What is the difference between ref, toRef and toRefs
A ref is a mechanism for reactivity in Vue 3. The idea is to wrap a non-object in a reactive object: Takes an...
Read more >
Advanced usage - Vuelidate
useVuelidate returns a computed , so you need to use .value when accessing any of it's properties, like $error , $validate inside the...
Read more >
Compose validation logics with Vue 3.0 and Vuelidate. - ITNEXT
One of the breaking change of Vue 3.0 is composition api. ... import { reactive, toRefs } from "@vue/composition-api";export default {
Read more >
Vue 3: Reactivity Made Easy (ref, reactive, toRefs... oh my!)
Working with Vue 3 can be confusing if you don't understand how reactive variables work. In this video I explore all the basics...
Read more >
Vue JS 3 Tutorial - 54 - Reactivity and toRefs - YouTube
Courses - https://learn.codevolution.dev/ Support UPI - https://support.codevolution.dev/ Support PayPal ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found