r/reactjs • u/Neat_Living_6765 • Sep 28 '26
Needs Help Has anyone implemented Server Components with plain React + Vite/plugin-rsc?
Hi everyone,
Could anyone help me with the two questions below?
Does every Server Component render at build time, get cached, and then get served from a CDN?
If I want to render a Server Component on every request, how do I implement that?
0
Upvotes
2
u/KalamKiTakat Sep 28 '26
Server Components are a rendering model, not a caching or hosting model. With
@vitejs/plugin-rscyou own the server entry: call the RSC renderer in your HTTP request handler rather than at build time, setCache-Control: no-store, avoid CDN caching for that route, and skip static prerendering for it. Also make sure any fetches inside the component run per request, or they can return cached data even when the render runs again.2
u/TheGrubbyPottery Sep 28 '26
the first one depends on your setup but generally yes they render at build time and sit in cache until you bust it, for on-demand rendering you need a actual server handling the requests not just vite dev server
2
u/[deleted] Sep 28 '26
[removed] ā view removed comment