Skip to content

Commit bae68f5

Browse files
authored
fix: state lazy evaluation in accessor (#75)
1 parent 770da26 commit bae68f5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: packages/typed-vuex/src/accessor.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ const createAccessor = <T extends State, G, M, A, S extends NuxtModules>(
4949
Object.keys(evaluatedState).forEach(prop => {
5050
if (!Object.getOwnPropertyNames(accessor).includes(prop)) {
5151
const namespaces = namespace.split('/')
52-
const state = getNestedState(store.state, namespaces)
5352
Object.defineProperty(accessor, prop, {
54-
get: () => state[prop],
53+
get: () => getNestedState(store.state, namespaces)[prop],
5554
})
5655
}
5756
})

0 commit comments

Comments
 (0)