triggerRef not update for shallowRef when watching multiple values (Array argument)
Version
3.2.30
Reproduction link
Steps to reproduce
1、watch shallowRef by arr 2、triggerRef
What is expected?
trigger watch
What is actually happening?
not trigger watch
as workaround:
watch(...[arr], ()=> {
console.log('watch [arr] : arr change, but not trigger watch')
})
Edit: I'm rather confused why the first one does work at all. It's a shallow ref.
Edit2: Nevermind I missed the whole point
its a bug.
this might be a possible patch
forceTrigger = source.some(isReactive)||source.some(isShallow)
@LinusBorg hi! can i ask a question about watch implementation? why do we treat ref and shallow ref differently, when we use shallow ref, the callback function is forced to fire.I don't seem to see the corresponding instructions on the official documentation.
@kuang-lingxi see #2231
thanks reply!actually I saw this issue yesterday via git commit. In the previous implementation, the check was skipped by judging whether it was a ref. actually I don't really understand why ref skips the check.
or i change the question, what is the expected behavior of the watch function when it accepts ref/shallow ref/reactive object? Is there any documentation on this?