Watch listens to computed and should not be triggered by ref in computed
Version
3.0.5
Reproduction link
https://jsfiddle.net/twgh75x4/4/
Steps to reproduce
test case
it('watching multiple sources: computed', async () => {
let count = 0
const _ref = ref('1')
const _computed = computed(() => !!_ref.value)
watch([_computed], () => {
count.value++
})
watch(_computed, () => {
count.value++
})
// When the _ref value changes
// in factthe _computed value remains the same
// watch should not be triggered
_ref.value = '2'
// count.value is 1, Is not the expected 0
await nextTick()
_ref.value = '3'
// count.value is 2, Is not the expected 0
await nextTick()
expect(count).toBe(0)
})
What is expected?
experct(count).toBe(0)
What is actually happening?
experct(count).toBe(2)
Seems to be a regression of https://github.com/vuejs/vue-next/issues/2231