I've tried having the v-if value set in computed, data, passed as props and just a direct reference to state but it NEVER re renders despite the fact that the state I check for is changed to true.
Currently I have it directly referencing the store
<template v-if="this.$store.state.showReviews">
I perform an AJAX Request in my Vuex Action
getBikeReviews(context, i){
console.log("getBikeReviews");
axios.get('http://mpaccione.com/wp-content/themes/webdev/projects/Web_Design_4/Creating_Online_Store/api/get_reviews.php?index='+i).then((res) => {
context.commit('storeBikeReviews', {"index": i, "json": res.data});
context.commit('showReviews', true);
});
}
The State gets Mutated to true
showReviews (state, payload){
console.log("showReviews");
state.showReviews = payload;
}
However the template never re-renders.
showReviews
initially declared in your vuexstate
? Vue cannot detect property additions. - Eric Guanthis
in template<template v-if="$store.state.showReviews">
- Morty Choi