Wild
Is it possible to initialize store state with async function ?
when you say a init function, is it like literally a function named init ?
Since I want to check the indexedDb only on the client, I've had some issue with the hydration. when I use skipHydrate, I have a cannot stringify non pogo error
8 replies
How to share an indexedDb
I changed my approach :
like L422Y, I use a store. The store has a internal state, where i store the ref to my IndexedDb.
When I access my db, I go through a computed getter which fetch the db if it is initialized, otherwise it set it.
And I use my store where need be
53 replies
How to share an indexedDb
I am very close !
@pyplaca still a order issue thing,
I found here https://medium.com/testing-nuxt-applications/introduction-to-nuxt-plugins-and-modules-7f10887ef31b that nuxt load Modules then plugin.
So as a pinia plugin, it get loaded before other plugin.
However, the time it take to resolve is enough to break the store, which starts hydrating before the plugin finished its' async stuff !
In parts due to me switchin from my homemade onHydrated trigger for the hydrate pinia function. I see that if I was waiting for it, it would work.
Any idea of how I could nicely wait for the plugin to resolve ?
53 replies
How to share an indexedDb
I am trying to initialize the indexeddb only once and then share a ref (not vue ref because I don't think reactivity is usefull here) to avoid all the onsuccess/ onerror boilerplate, is that what you do in your composable ?
We used a plugin with @pyplacca to instanciate our db, can this be bypassed with just using a composable ?
53 replies