vercel / next-react-server-components

Demo repository for Next.js + React Server Components
https://next-rsc-hn.vercel.app
MIT License
979 stars 158 forks source link

rsc.server.js rendered twice #10

Closed ms-sch closed 2 years ago

ms-sch commented 2 years ago

How to reproduce

Add some console.log at function News() -> https://github.com/vercel/next-rsc-demo/blob/main/pages/rsc.server.js#L39 Run next with next dev Go to http://localhost:3000/rsc Check console output

So the problem is that each Page/Component is wrapped by RSCComponent -> https://github.com/vercel/next.js/blob/v12.0.5-canary.4/packages/next/client/index.tsx#L716 this component use another component RSCWrapper, which hit server second time

shuding commented 2 years ago

This is currently expected but we will improve this with https://github.com/vercel/next.js/issues/30994, thanks for the feedback!