-
- Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
Description
Vue version
3.4.35
Link to minimal reproduction
Steps to reproduce
const b = ref(ref(1)); console.log(b.value.toFixed()); // 1 b.value = ref(2); console.log(b.value.toFixed()); // runtime error
What is expected?
Either:
- it should not be possible to put one
ref
into another; b.value
returns 2 instead of theref(2)
.
What is actually happening?
Here, the type of b is Ref<number, number | Ref<number>>
. This means that we can set it to Ref<number>
and get a number
, but if we set b.value
to ref(1)
, we actually get ref(1)
back, which is not a number.
Any additional comments?
Caused by #11442 as a fix of #6766.
As an option, to adjust logic with the current types, we may return the value of the nested ref in the _value
getter of the RefImpl
class.
Metadata
Metadata
Assignees
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.