Trying to upgrade a project that is a couple of years old that uses vuex as store to the latest version of Vue3 with Vite and Typescript.
Now stuck on an issue with getters calling other getters. This used to work and I managed to get it to compile without issues but I am now getting an error when upgrading.
"TypeError: Cannot read properties of undefined (reading 'GET_POSITION_ISSUE')"
[GET_MERGED_ISSUES]: (state, getters) => (position) => {
...
let positionIssue = getters[GET_POSITION_ISSUE](position)
...
}
It compiles after setting :any on the parameters, but gives runtime error.
A complete rewrite using Pinia is in the works, but I would prefer not to redo it all at once but transferring functionality piece by piece instead.
Any help would be appreciated!
After some more research I found a way to access the getter by importing the store and going that way. Maybe not the correct way but it will do until we move to Pinia.
import { store } from '../..'
[GET_MERGED_ISSUES]: (state) => (position) => {
...
let positionIssue = store.getters[GET_POSITION_ISSUE](position)
...
}