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

Remove the Suspense boundary for individual items #15

Closed shuding closed 2 years ago

shuding commented 2 years ago

As mentioned in https://github.com/vercel/next-rsc-demo/issues/13#issuecomment-988319153, we think removing the spinners for individual items will reduce layout shift and improve the overall experience of this app.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vercel/next-rsc-demo/FT3wzMadDiwbM3QeMpyKLJaE4Qkm
✅ Preview: https://next-rsc-demo-git-shu-0653.vercel.sh

gaearon commented 2 years ago

When I tried this locally I got weird hydration errors. Is that specific to me?

shuding commented 2 years ago

Not specific to you, that's something we are looking into — reverting to a previous Next.js release should fix it (#14).

vercel-team commented 2 years ago

📝 Changed routes:

/rsc.server
Screenshot of /rsc.server
(view full size)

Commit 4a72a0112d450bb098026b60c84d6a9c389ddf17 (https://next-rsc-demo-meerkdgkc.vercel.sh).

gaearon commented 2 years ago

Should we also fix up the parent suspense boundary to be more natural than a spinner? For example by giving body min height and then making the fallback empty, or something.

shuding commented 2 years ago

Good call, min div height with some skeletons inside (that matches the item height) will be better.

shuding commented 2 years ago

Updated with animating skeletons: https://next-rsc-demo-git-shu-0653.vercel.sh/rsc. Should be good for now I think.

gaearon commented 2 years ago

Can we make it so that the height of the skeleton is the same as the height of the content? Do we not know the number of the rows or the size of each?

shuding commented 2 years ago

❤️

gaearon commented 2 years ago

Sometimes when I refresh I get this:

Screenshot 2021-12-08 at 00 23 51 Screenshot 2021-12-08 at 00 23 35

But not every time.

gaearon commented 2 years ago

When it's broken, I can see the scripts on the right are missing from the HTML:

Screenshot 2021-12-08 at 00 30 28