Michael Schaufelberger
Can I use the "Streaming with Server Components" strategy with tRPC?
something maybe offtopic: the trpc example now produces a hydration error because of toLocaleString on my machine. which makes sense, since the browser has a different locale configured. not sure if that's intended for such an example
68 replies
Can I use the "Streaming with Server Components" strategy with tRPC?
Huh, interestingly, it still doesn't work with rc.441 (same code as before)
However, as soon as the page is exported as an async function (
export default function Home
vs export default async function Home
) it works. This happens in dev and prod mode.68 replies
How do I use the rsc-rq-prefetch example with a protected procedure?
What version of tanstack react-query do you use? Maybe that's the issue and not trpc itself...
Since, I don't think trpc is deciding if it should run during SSR or not...
If you do something like this
in the
httpBatchStream
, and also log the headers in the protected procedure middleware - does it get logged? Because I think my setup is wrongfully calling the useSuspense query on the server during SSR and, since the server during rendering is somehow not authed, it fails...22 replies
Can I use the "Streaming with Server Components" strategy with tRPC?
Hi Julius
I've tried this and updated the TanStack query library. However, I'm still experiencing the same behaviour.
The repro based on today's state of the trpc app dir example is here:
https://github.com/michaelschufi/trpc-next-app-dir-2
The significant changes I made:
https://github.com/michaelschufi/trpc-next-app-dir-2/commit/f7de44043d686b7fffad68ae23011edcc4fb1205
68 replies
How do I use the rsc-rq-prefetch example with a protected procedure?
So what I would expect is:
The trpc handler should be hit 1-2 times instead of 3 times.
- Once for the
void trpc.foo.prefetch();
in page.tsx
('x-trpc-source': 'rsc'
)
- Maybe once for the trpc.foo.useSuspenseQuery();
in foo.tsx
('x-trpc-source': 'react-query'
) in case the server prefetch failed.
But it should never be called during SSR with the trpc client component in rcc.tsx
('x-trpc-source': 'react-query-ssr'
).
Are those assumptions correct?22 replies
How do I use the rsc-rq-prefetch example with a protected procedure?
Hmm, does your trpc client component client run during SSR?
I'm experiencing strange behaviour...
My next.js receives 3 trpc requests for the following page:
foo/page.tsx
Server Logs
22 replies
How do I use the rsc-rq-prefetch example with a protected procedure?
Hi @testsubject1137
Have you had some success with more recent versions in the meantime? Even with rc.403, I'm getting an error in my
isAuthed
trpc middleware.
since, as you've said, the server is running the client component query during ssr.22 replies