I found an error with Router Cache. This app works fine initially: Server Component's RSC Payload stays cached on browser for the first five minutes (dynamic page). However, after 5 minutes, when first invalidation happens, it just never gets cached again and keeps fetching on every single navigation. If I refresh the page, the Router Cache becomes fine again until the next invalidation.
# start the node server first (which provides an example api endpoint of https://localhost:8001
node server.js
# start the next.js web server
npm install
npm run build
npm run start
-
First if you go to http://localhost:3000, you will see the two values (
from client: some value
andfrom server: some value
) -
If you navigate between the
hello
page and thehome
page, you can see the Router Cache works perfectly, only caching the server component render. -
Now leave it alone for 3ish minutes (invalidation time for dynamic route)
-
Come back and again navigate between
hello
page andhome
page. -
Now both values change every time you navigate... This is not intended behavior.
-
If I refresh, it works again...