I need your help.There is a Vue app where I use vuex store and vue-router. The problem is that I get store data from API calls and if I navigate to blabla/edit-profile
page from somewhere else the user data is already in store and in component I can use this data recieved by getter.
But if I reload the page getters in create or mount method doesn't contain any data. But if look in Vuex dev tool I can see fetchedd data.
How can I fix this behavior?
0
votes
1 Answers
0
votes
Instead of having getters in the mounted or created properties you can try having them in computed properties. That way it will make sure to load your data when it's actually wanted https://vuejs.org/v2/guide/computed.html.
Also you can try checking for Caveats https://vuejs.org/v2/guide/list.html#Caveats . The data might be not be reactive friendly for Vuejs to load it after it gets fetched.
/blabla
) or are they in App.vue (or wherever you've got the<router-view>
component?) – LShapzcreated
andmounted
hooks and only use them inside the template ? – IVO GELOV