functiondjF
tRPC6mo ago
8 replies
functiondj

Keep subscription `.data` after stopping (Tanstack Query)

It looks like
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())
).

const trpc = createTRPCReact<AppRouter>()
const trpcClient = trpc.createClient({...})
Was this page helpful?