Wild
Explore posts from serversuseASyncData & watch issue
Hello friends,
I've been having a hard time using watch. I've finally found a suitable ref for watch, but the refresh is too late. My store update but what is displayed is one step behind.
If i change the lang from fr to en, it'll show fr, and from en to es, it'll show es.
What am I missing ?
If I use a plugin with and manually call refresh, it works as I would like it to.
Thanks for your time !
2 replies
Is it possible to initialize store state with async function ?
Hello friends,
I am trying to set up my store from indexedDb.
I've seen an example with useLocalStorage from vueUse, but how can I make it works with custom function ?
Thank for the help
8 replies
Need some help about useFetch usage
Hello friends,
anyone knows why a useFetch would trigger once on the client although the getCachedData return data from localstorage ? I got getCachedData into getCachedData into onReponse into Transform.
Some code since it might help :
2 replies
Data Fetching, Store and LocalStorage
Hello friends,
I am trying to understand the store lifecycle, but I have yet to find a good article / document on the topic.
I understand that there is data fetching from the server and from the client.
I was originally planning to set up a store and initializing some state from the server, for website often-updated data with usefetch server true, and some persitent data with a mix of usefetch server false and localstorage.
My issue is that I cannot control when the state is set up, and so localstorage and client side state initialization fails unless I use some kind of onMounted, getCurrentInstance and process.server shenanigans.
I want control when the state is set up, because at the moment I just get an empty {} : the state try to initialize once, fails which is normal cause SSR.
Should I just trigger some actions from the client ? This seems like a lot of boilerplate.
Any relevant resource or document ?
Is there a way to control when the store is set up ?
How would you approach this kind of thing ?
I was trying to keep things simple because all that's needed is a nicely timed localstorage getitem and setitem, but maybe I should look into some persisted state plugin.
Thank you very much for your help, insight and time
7 replies