Seeking Feedback on useQueryStream Hook for Observable Integration with React Query #7581
Unanswered
marcog83
asked this question in
Show and tell
Replies: 1 comment 5 replies
-
gonna tag @KATT and @juliusmarminge here because I think they have an SSE implementation in trpc 👀 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi TanStack Team,
First off, a huge thank you for the fantastic work you’re doing with React Query! It’s been a total game-changer for us, making server state management a breeze.
I’m reaching out for some guidance to validate an idea we’ve been tinkering with—creating a custom hook called
useQueryStream
to handle server-sent events (SSE) with React Query. We know you’ve mentioned before that streaming data flows aren’t officially supported, but we think our situation might be a bit different, and we’d love to get your take on it.Here’s Our Situation
Our backend team has endpoints that serve up large data lists and they’ve enabled SSE to push updates in real-time. We’ve got over 10 products, each managed by different frontend teams made up of external developers, junior devs, and a mix of others. If we leave SSE integration up to each team, it’s likely to get pretty messy and inconsistent.
To keep things clean and simple, we’re planning to build an internal library that handles SSE, published the npm registry. We’re committed to using React Query because we love its interface, documentation, and overall approach. Our goal is to create a layer on top of React Query that hides the complexity of SSE but still feels familiar to our developers.
Usage of
useQueryStream
The
streamQueryBehavior
BehaviorHere’s a simplified version of what we’re working on:
Why We’re Doing This
We want to make SSE integration super easy for our devs, especially those who aren’t as familiar with it. Our main goals are to:
This is the status
How You Can Help
We’d really appreciate any feedback you can give us on this approach. Specifically:
useQueryStream
hook?Thanks a ton for your time and for any insights you can share!
Best,
Marco
Below you can find the sandbox with the implementation
https://codesandbox.io/p/sandbox/use-subscription-query-83d72d?file=%2Fsrc%2Fgrid-stream.tsx%3A5%2C2-8%2C6
Beta Was this translation helpful? Give feedback.
All reactions