Open dalechyn opened 2 months ago
im kinda confused by this issue. There is no trpc here, the built-in hono fetcher is how we achieve type-safety in the first place and the superjson implementation already exists. If we can find a good way to make the streamed hydration possible w/ the superjson integration I dont see why not
im kinda confused by this issue. There is no trpc here, the built-in hono fetcher is how we achieve type-safety in the first place and the superjson implementation already exists. If we can find a good way to make the streamed hydration possible w/ the superjson integration I dont see why not
oh lol i haven't checked the code and assumed by the file layout it's trpc. great job!
then focusing on the streamed hydration only.
It is possible by passing transformer
prop to ReactQueryStreamedHydration
.
I think you can replace this code
https://github.com/upstash/jstack/blob/ee3f48a4f07f172c4d191cf2a1b597e3144da76c/src/app/page.tsx#L13-L24
with an even easier implementation by using
ReactQueryStreamedHydration
and withuseSuspenseQuery
. I use such in production and have no issues and don't need to prefetch queries by hands.but also be aware that if a
transformer
is used intrpc
you'll have to pass it toReactQueryStreamedHydration
too.On the Hono part. Why is it really needed? I had projects with trpc without Hono and they worked fine.
Also fyi hono has a full-typed fetcher that I use instead of trpc nowadays. It doesn't have a native transport support (like superjson), but it is quite easy to write one yourself.