JS ERROR TypeError: undefined is not an object (evaluating '_this._store.rootGetters')
VannaDii opened this issue · comments
Calling metrics.getMetricsDesc();
which is defined as:
import Vue from 'vue';
import Vuex, { Store } from 'vuex';
import { getStoreBuilder } from 'vuex-typex';
import { MetricsState } from './metricsState';
export interface RootState {
metrics: MetricsState
}
Vue.use(Vuex);
const store: Store<RootState> = getStoreBuilder<RootState>().vuexStore();
export { store };
export default store;
import { RootState } from './store';
import { getStoreBuilder } from 'vuex-typex';
const initialMetricsState: MetricsState = {
allMetrics: [],
isLoading: false
}
const builder = getStoreBuilder<RootState>().module('metrics', initialMetricsState);
const metricsDesc = builder.read(state => state.allMetrics.sort((a, b) => (a.date > b.date ? -1 : 1)), 'metricsDesc');
const metrics = {
// State
get state() { return builder.state(); },
// Getter as method
getMetricsDesc() {
return metricsDesc();
},
}
@GioCirque
I ran into the same error, did you ever find out why you got this error?