use createQuery inside of top level `+layout.svelte`
I am using SvelteKit and attempting to plug in SvelteQuery
In my
+layout.svelte file I would like to fetch some data and populate a search index to make the search index globally available to the rest of the application
On of the problems I am having is I can't figure out how to use Svelte Query in the +layout.svelte file
+layout.svelte:
but I end up with an error:
and I see why, because I have wrapped my application with the QueryClientProvider:
so it makes sense that it would be available to other components, and not available in the +layout.svelte context
Is it possible to pass the queryClient to the createQuery function? or something that would allow me to use SvelteQuery to fetch the data in the +layout.svelte file at the root of the application?0 Replies