You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use toRefs with a writable computed the set method is never executed.
Here is an example:
import{ref,computed}from'vue';import{toRefs}from'@vueuse/core';constx=ref({bar: 'Bar'});constfoo=computed<{bar: string}>({get(){returnx.value;},set(v){console.log('Setting value',v);// Never calledx.value=v;}});const{ bar }=toRefs(foo);bar.value='Baz';
Although both bar and x will have their underlying values updated in this example, it does not go through the set method as expected. This prevents toRefs from being used with other methods that return writable computed refs like useVModel. In one of the example use cases with useVModel the "update:data" is never actually emitted like it shows.
If this sounds like a legitimate issue I would like to open a PR to resolve it.
The text was updated successfully, but these errors were encountered:
If you use toRefs with a writable computed the
set
method is never executed.Here is an example:
Although both
bar
andx
will have their underlying values updated in this example, it does not go through theset
method as expected. This preventstoRefs
from being used with other methods that return writable computed refs likeuseVModel
. In one of the example use cases withuseVModel
the "update:data" is never actually emitted like it shows.If this sounds like a legitimate issue I would like to open a PR to resolve it.
The text was updated successfully, but these errors were encountered: