changes to $attrs don't trigger options API watcher
Version
3.1.4
Reproduction link
https://jsfiddle.net/Lg38t5qh/18/
Steps to reproduce
- create component
- watch $attrs
What is expected?
$attrs watcher is triggered on attributes change
What is actually happening?
$attrs watcher is not triggered
you need a deep: true
watcher, because the value of $attrs
doesn't change - it's the same object - only a property on that object changes
@LinusBorg this behavior differs from Vue2 :) Probably should note that at least for compat build :)
Hm, indeed. I'll open it for now as I'm not sure from the top of my head wether that was intentional etc.
The thing is, it's inconsistent. Vue 3 does trigger watch callbacks when provided a normal object. Like Vue 2. But for $attrs it doesnt work.
It does with a reactive object but $attrs
is not a reactive object (https://v3.vuejs.org/guide/composition-api-setup.html#context). Maybe something to add for compat build if possible