Skip to content

Commit

Permalink
fix: state lazy evaluation in accessor (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
moajo authored Feb 3, 2020
1 parent 770da26 commit bae68f5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/typed-vuex/src/accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ const createAccessor = <T extends State, G, M, A, S extends NuxtModules>(
Object.keys(evaluatedState).forEach(prop => {
if (!Object.getOwnPropertyNames(accessor).includes(prop)) {
const namespaces = namespace.split('/')
const state = getNestedState(store.state, namespaces)
Object.defineProperty(accessor, prop, {
get: () => state[prop],
get: () => getNestedState(store.state, namespaces)[prop],
})
}
})
Expand Down

0 comments on commit bae68f5

Please sign in to comment.