I've been using Vue for a while, and my experience has always been a method will recompute if its underlying reactive data is updated. I've encountered conflicting information on SO:
- I was attempting to answer this question, and was told multiple times that this isn't the case.
- The accepted answer here indicates that "[a method] will only be evaluated when you explicitly call it."
I searched through the docs and I didn't see anything incredibly clear.
If they are not reactive, then why does this example work?
<ul>
<li v-for="animal in animals" :key="animal.id">
<span v-if="isAwesome(animal)">{{ animal.name }}</span>
</li>
</ul>
export default {
data() {
return {
awesomeAnimalIds: [],
animals: [
{ id: 1, name: 'dog' },
{ id: 5, name: 'cat' },
{ id: 9, name: 'fish' },
],
};
},
created() {
setTimeout(() => {
this.awesomeAnimalIds.push(5);
}, 1000);
setTimeout(() => {
this.awesomeAnimalIds.push(9);
}, 2000);
},
methods: {
isAwesome(animal) {
return this.awesomeAnimalIds.includes(animal.id);
},
},
};
I would really like to have a definitive and satisfying answer that this community can refer to.

methodsare not reactive per-se. If they contain reactive references, a change to any of those will trigger a re-render in the template, if the template uses the method, which will re-call the method (that's why your example works). To explain this better: if you didn't reference the method in the template, it would not get re-run, even if internal refs changed. So you can't watch a method for changes and expect that watcher to be triggered whenever internal reactive refs inside the method get changed. Hope that makes sense.