AnteG
[SOLVED] Solid Router v11 + TanStack Query issue
It seems that the problem lies on my end. To eliminate all the extraneous noise in my codebase regarding this problem, I've created a fresh Solid.js template with Tanstack Query and Solid Router v0.11. In this simplified setup, everything appears to be functioning correctly. I'm using
ensureQueryData
in load functions and createQuery
in components, allowing me to retrieve cached results from the load function as expected. Here's the repository if anybody is interested in the setup: https://github.com/agazibaric/solid-with-tanstack-query.
Thank you for your assistance!5 replies
[SOLVED] Solid Router v11 + TanStack Query issue
Thank you for the answers. I've moved my
createQuery
to the component level and used the esureQueryData
in the load function. I've also added a delay of 1 second to the fetchMe function so I can see does the prefetched cache works as expected. On hover of the link I can see that the ensureQueryData
fetches the needed data, but when I actually click to go to the next route createQuery
again takes 1 second to respond, instead of returning the prefetched results. Do you have an idea of where could be the issue?
As a side note, with this setup, to ensure that there is no error thrown: No QueryClient set, use QueryClientProvider to set one
, I needed to wrap the Routes
component with the QueryClientProvider
, instead of wrapping the App
component.5 replies