Reading the docs about computed properties, it is said:
A computed property will only re-evaluate when some of its dependencies have changed.
It’s kind of misleading because it suggests that any dependency change will make the propertie re-evaluate. This is partially false as only the dependencies directly used in the returned value are taken into account.
Exemple (this is a vuex getter exemple, but it basically works the same):
// does NOT work (media isn't reactive)
media: (state, getters) => id => {
const media = state.medias.find(baseMedia => baseMedia._id === id);
return {
...media,
ownMedia: media.userId === state.user._id,
};
}
// works
media: (state, getters) => id => {
return {
...state.medias.find(media => media._id === id),
// functions allow to reference own object's properties
ownMedia() { return this.userId === state.user._id }
};
}