Cratis
Cratis•12mo ago

Server Component reactivity

Hey all, I have a bit of a dumb question. If trying to use convex with server components in nexths you won't get the real-time update changes shown in the UI correct?
5 Replies
erquhart
erquhart•12mo ago
Another great answer from the docs AI chat:
Correct, currently when using Convex with server components in Next.js, the data won't be fully reactive. This is because Convex requires a connection from your deployment to the browser in order to push updates as data changes and this must happen on the client-side. If you load data from Convex on the server, it will be non-reactive. Convex is investigating ways to combine Next.js server-side rendering with end-to-end reactivity. So, stay tuned for updates on this.
erquhart
erquhart•12mo ago
Next.js Server Rendering | Convex Developer Hub
Next.js automatically renders both Client and Server Components on the server
lee
lee•12mo ago
Note also this part of that doc:
If you want to preload data from Convex and leverage Next.js server rendering, but still retain reactivity after the initial page load, use preloadQuery from convex/nextjs.
(i don't know why the docs chat doesn't know about this... 😕 )
erquhart
erquhart•12mo ago
Oh preloadQuery works with server components, nice!
Cratis
CratisOP•12mo ago
Thx all 🙂 I love the support from you guys , always incredibly helpful!

Did you find this page helpful?