Should `prefetchQuery` be await'ed inside the route's `loader`?
I couldn't find any info in the docs specifically about calling
queryClient.prefetchQuery
inside of a route's loader
method. Based on my understanding of both methods, it seems like I would not want to await the prefetchQuery
calls since it would block the route from rendering until the query/queries are finished fetching rather than handling the loading state inside the component.
For example:
4 Replies
fair-rose•16mo ago
you can await the one for useSuspenseQuery and not the other one. yes, a waiting blocks, but so does useSuspenseQuery
noble-goldOP•16mo ago
Ok, that's what I thought. I wasnt sure about the options query (the one I am using suspense with) since I figured that the router could at least render the other matching routes without waiting.
fair-rose•16mo ago
yes it's likely better to not wait for this one
noble-goldOP•16mo ago
Awesome, thanks! Just wanted to verify that I was understanding correctly. 🙂