tRPCttRPC
Powered by
RamazanR
tRPC•3y ago•
2 replies
Ramazan

`useSuspenseQuery` still runs a fetch on SSR even when setting `ssr: false` in the api config

Beside double-fetching, this causes issues during rendering if you have auth on your routes as the SSR server doesn't seem to pass through the cookies to the tRPC route.

Using Next.js 14.0.3 with the pages directory.

Repro here: https://github.com/relsunkaev/trpc-ssr-suspense-repro
GitHub
GitHub - relsunkaev/trpc-ssr-suspense-repro
Contribute to relsunkaev/trpc-ssr-suspense-repro development by creating an account on GitHub.
GitHub - relsunkaev/trpc-ssr-suspense-repro
Solution
Answered in the issue - not a bug. Use
Suspense.CSROnly
Suspense.CSROnly
from @suspensive/react
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

queries running on server even though ssr is set to false
felipemaffezzolliFfelipemaffezzolli / ❓-help
3y ago
Do tracked properties still work when using useSuspenseQuery?
DavidDDavid / ❓-help
3y ago
What is a useSuspenseQuery?
rustclanRrustclan / ❓-help
2y ago
Correct way to fetch trpc data on SSR and CSR
v28Vv28 / ❓-help
16mo ago