I was wondering whether watchers being triggered when replacing an array with a different instance of an array with identical contents is a bug or a feature in Vue. I understand the underlying comparator probably uses
=== but the $watch documentation is not 100% clear on what makes a “change”. The fact that there is also “deep” watching but it does not apply to arrays does not make the situation better.
- Is this actually a bug or a feature?
- If it is a feature, is it somewhere documented?
- If it is a feature, how do people go about not triggering watchers when arrays are replaced with identical contents (other than using your own “deep equals” algorithm in the watcher callback)?
Here is a fiddle I used for playing around: https://jsfiddle.net/8v0g9zou/1/