I am creating a language flashcard app and am having issues with the state updating when I switch lists. So I see that in my store the mutations are being fired but in my Vuex Dev Tools the state is not registering a change despite the vue updating somewhat...
HTML
<label style="margin-left: 5px">Word List</label>
<md-select id="list-select" v-model="currentList">
<md-option v-for="(list, index) in wordLists" :key="index" :value="list.id">
{{list.name}}
</md-option>
</md-select>
JS Component
import {mapGetters} from 'vuex';
...
computed: {
...mapGetters({
showModalState: 'showModal',
computedList: 'currentListWords',
wordLists: 'wordLists'
}),
...
watch: {
currentList(val) {
let list = this.wordLists.filter((v) => v.id === val).slice();
this.$store.commit("setCurrentList", list);
this.$store.commit("setTempList", list);
}
...
JS Store Mutations
setCurrentList(state, payload){
state.currentList = payload;
},
setTempList(state, payload){
state.tempList = payload;
},
JS Getters
wordLists(state){
return state.wordList;
},
currentList(state){
return state.currentList;
},
STORE
...
currentList: [],
wordLists: [],
...