T
TanStack•2y ago
yammering-amber

Streaming with Remix

Is it possible to stream in a query using a remix loader? https://tanstack.com/query/latest/docs/framework/react/guides/ssr#full-remix-example The examples on this page all await the api to fully finish before rendering the page which isn't the user experience that I want. I want to stream in the response instantly but kick off the api on the server for better performance. Is there a way to achieve this? I've seen the Next JS app router has an experimental package for streaming https://tanstack.com/query/latest/docs/framework/react/examples/nextjs-suspense-streaming, is there anything similar for remix?
React Query Nextjs Suspense Streaming, Example | TanStack Query Docs
An example showing how to implement Nextjs Suspense Streaming, in React Query
Server Rendering & Hydration | TanStack Query Docs
In this guide you'll learn how to use React Query with server rendering. See the guide on Prefetching & Router Integration for some background. You might also want to check out the Performance & Request Waterfalls guide before that.
1 Reply
yammering-amber
yammering-amberOP•2y ago
@TkDodo 🔮 any problems with doing something like this? https://stackblitz.com/edit/remix-run-remix-uswxqa?file=app%2Froutes%2F_index.tsx
Ryan
StackBlitz
Remix-run - React query streaming (forked) - StackBlitz
Build Better Websites. Create modern, resilient user experiences with web fundamentals.

Did you find this page helpful?