vercel / next-react-server-components

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

Breaks browser button behavior and unnecessarily re-renders page #50

Closed redbar0n closed 1 year ago

redbar0n commented 1 year ago

Reproduction:

  1. Go to https://next-rsc-demo.vercel.sh/csr or https://next-rsc-demo.vercel.sh/rsc
  2. Click into a post's comments
  3. See skeleton and wait for "loading comments"
  4. Toggle close one of the comment threads.
  5. Click browser back button, to go back to main page.
  6. Click browser forward button.
  7. Problem: Now you have to experience step 3. again.
  8. Problem: The comment thread you previously toggled will now be untoggled. Due to the re-rendering.

Expectation:

Clicking browser Forward button in step 6. should simply take you to the page you previously just saw. Also, the state of anything you toggled on that page should be the same as how you put it when you clicked the browser Back button.

leerob commented 1 year ago

This has been fixed on the latest version: https://next-rsc-hn.vercel.app/