Note: the npm build for this version is wrong - use 0.6.1 instead. Just specify ^6.0.0 and you will get it.
Sorry for another release with breaking changes - but I'd rather ship it sooner than later! Please bear with me before we reach 1.0, but this is pretty close :)
Breaking
-
vuex.state
option has been renamed tovuex.getters
:vuex: { getters: { count: state => state.count } }
vuex.state
still works - but you will see a deprecation warning about it. -
Getters are now required to be pure functions. This means they can no longer access
this
. This makes them globally cacheable - thus the same expensive getter shared across multiple components will be evaluated only once for all of them.If you need
this
to compute local derived state, just define separate, local computed properties:vuex: { getters: { currentId: state => state.currentId } }, computed: { isCurrent () { return this.id === this.currentId } }