[Vuejs]-Vuex getter does not update on another component depending on timing

0👍

Since it’s an object Vue can’t detect the changes of the properties and it’s even less reactive when it comes to computed properties.

Copied from https://vuex.vuejs.org/guide/mutations.html:

When adding new properties to an Object, you should either:

Use Vue.set(obj, 'newProp', 123), or

Replace that Object with a fresh one. For example, using the object spread syntax we can write it like this:

state.obj = { ...state.obj, newProp: 123 }

Leave a comment