tRPCttRPC
Powered by
functiondjF
tRPC•5mo ago•
8 replies
functiondj

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

It looks like
mySubscription.data
mySubscription.data
is
undefined
undefined
after the subscription stops from the server side (returning from generator function).

Can I keep this data without introducing my own
useState
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())
useSubscription(trpc.mySub.useOptions())
).

const trpc = createTRPCReact<AppRouter>()
const trpcClient = trpc.createClient({...})
const trpc = createTRPCReact<AppRouter>()
const trpcClient = trpc.createClient({...})
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

tRPC v11 with Tanstack React Query - queryOptions/mutationOptions methods missing
lassiterLlassiter / ❓-help
7mo ago
trpc subscription with react-query
kamamaKkamama / ❓-help
3y ago
How to update query data after mutation
kamamaKkamama / ❓-help
3y ago
keep previous data
shikishikichangchangSshikishikichangchang / ❓-help
2y ago