T
TanStack2y ago
foreign-sapphire

Query dependencies

Is there any way to mark one query as dependency of another query? literally, I need to pass part of the data from one query into another one. I don't think enabled: would work for me, as I need to hold suspense and resolve all of these queries during SSR phase. I could probably combine them in the same async+query, but that means I can't reuse first query without the second one
3 Replies
flat-fuchsia
flat-fuchsia2y ago
Do you use useSuspenseQuery or not?
foreign-sapphire
foreign-sapphireOP2y ago
I thought in solid-query all queries are “suspense” now and there is no alternative
metropolitan-bronze
metropolitan-bronze2y ago
That is true, queries in solid automatically suspend but suspense in solid is at the data access level, not component level like in react. I recommend the queryOptions API. You can then use the query client method "ensureQueryData" within the queryFn of the dependent queries. The ensureQueryData method will take the query options as args. This way it should all resolve during SSR time without refetching

Did you find this page helpful?