Bug with passing object with ref to props
Version
3.2.20
Reproduction link
Steps to reproduce
- run reproduction
- open browser dev tools
What is expected?
Expected Ref to be unwrapped
What is actually happening?
In dev tools:
[Vue warn]: Invalid prop: type check failed for prop "msg". Expected String with value "[object Object]", got Object
at <Hello msg=Ref< "hello" > >
at <Repl>
Full example of usage: https://codesandbox.io/s/laughing-zhukovsky-17qpf?file=/src/App.vue
This behaviour is correct. You pass a non-reactive object, and unwrapping only happens for reactive objects.
This behaviour is correct. You pass a non-reactive object, and unwrapping only happens for reactive objects.
What about this example? if use reactive object, computed not recalculate https://codesandbox.io/s/laughing-zhukovsky-17qpf?file=/src/App.vue
This behaviour is correct. You pass a non-reactive object, and unwrapping only happens for reactive objects.
In repl msgWrapper
not reactive, but msgWrapper.msg
- ref:
<other :msg="msgWrapper.msg" />
What about this example? if use reactive object, computed not recalculate
useDataLvl1
returns a reactive object - which will unwrap the message ref. So when you spread this reactive object into a new one in useDataLvl2
, the new object doesn't get the message ref, only its value at that time.
Also: expected.