Vuex: Does Vuex store not track objects?

Created on 18 Dec 2016  路  1Comment  路  Source: vuejs/vuex

Hello, I'm trying to implement dropdown handling, which requires a global state to make sure only 1 dropdown is open at any time.

I was able to get to this stage: https://jsfiddle.net/ssr9pkLa/1/

However, check the comments on lines 12 and 45. The VM will be refreshed only if the state root property is changed AND it is displayed in template.

Looking at the javascript object of state properies I see that there are custom getters and setters for deep object trees, but doesn't look like they're really being tracked.

Is that by design, that objects can't be tracked?

Thanks.

Most helpful comment

It is by design of Vue. We must initialize possible object properties or use Vue.set to add new object properties.
https://vuex.vuejs.org/en/mutations.html#mutations-follow-vues-reactivity-rules

>All comments

It is by design of Vue. We must initialize possible object properties or use Vue.set to add new object properties.
https://vuex.vuejs.org/en/mutations.html#mutations-follow-vues-reactivity-rules

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gdelazzari picture gdelazzari  路  3Comments

fnlctrl picture fnlctrl  路  4Comments

jskrzypek picture jskrzypek  路  3Comments

weepy picture weepy  路  3Comments

Sarke picture Sarke  路  3Comments