Keep subscription `.data` after stopping (Tanstack Query)
mySubscription.data
is undefined
after the subscription stops from the server side (returning from generator function).
Can I keep this data without introducing my own useState
and leverage Tanstack Query instead?
I'm using the old React Query integration because there's no documentation for the new integration for subscriptions (i.e. useSubscription(trpc.mySub.useOptions())
)....How to compress procedure response
A cleaner web experience for this forum

useInfiniteQuery: `hasNextPage` does not seem to consider fewer-results-received-than-`limit`-given
hasNextPage
to correctly be false
when the records received were more than 0 but fewer than the limit
prop (that's next to the cursor
prop at the endpoint)?
To clarify the problem to solve: right now my limit
is 11
and queries with 0 results correctly result in a hasNextPage
of false
, but queries with 1 or 2 results seem to have it true
.
How do y'all typically tackle this subtlety?...BUG: useSuspenseQuery does not forward TRPC options to context
Recommended setup for tRPC + Tanstack Query Subscriptions
import { useSubscription } from "@trpc/tanstack-react-query";
...creating middleware with context type as param
How to handle 500s from prefetching

better-auth with trpc server side
Usage of trpc with nextjs ssg
best strategy for handling global trpc errors on the client
TRPCError
with code FORBIDDEN
and a custom message:
```ts
const guildIsBanned = await ctx.db.guildBotBans.findFirst({
where: { guildId: input.guildId },
});...Debug httpBatchStreamLink in DevTools
chunked
, but it seems to me like Chrome (in my case) won't store the result of the request to be shown in the Network tab in devtools.
This is making debugging very painful.
Can I do anything about this while still being able to stream the response?...
TS error regarding inferred type of 'appRouter'
Shorten /app/api/trpc/[trpc]/route.ts
/app/api/trpc/[trpc]/route.ts
to register the tRPC handler in a Next.js project.
Can I shorten this to e.g. /app/api/route.ts
?
If yes, what's the endpoint
that I need to pass to fetchRequestHandler
and what's the url
I need to pass to httpBatchLink
?...Stream error polluting sentry - only on Safari
AbortError
abort pipeTo from signal
.
This errors only happens on safari <16.4, so it matches the chat gpt explanation.
...
Setting up tRPC without breaking Frontend's typechecking
Invalidate all queries in new TanStack React Query Setup
createTRPCReact
anymore and I can't seem to find any other method from the docs where I can pass these overrides :x Thanks!...hono, next.js ssr & better-auth cookies
const session = await auth.api.getSession({ headers: c.req.raw.headers });
in my trpc batchLink, I just tried to put headers like this:...Deduplicating identical queries in tRPC httpBatchLink (standalone server + Next.js server-side)