T
TanStack3mo ago
extended-salmon

Disabling `useSuspenseQuery` on the server with TanStack Start

Hey! I'm using TanStack Start + Query together, using suspense everywhere, and have a long-running query that I don't want running in SSR. I'd rather it just run on the client. I originally thought I could just disable the query, but found enabled is not a supported property with useSuspenseQuery. I understand the reasoning for this but not sure how I can go about selectively disabling the query from running in SSR? I also thought I could return undefined but this doesn't quite feel right.
2 Replies
stormy-gold
stormy-gold3mo ago
You would need to not render the component I think, or let it run but have it error on the server
extended-salmon
extended-salmonOP3mo ago
I don't know why I didn't think of that 🤦‍♂️ thanks @TkDodo 🔮

Did you find this page helpful?