Next.js Discord

Discord Forum

Need help understanding how to solve caching/SSR issue

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hi everyone, I have this site: https://games.stlr.cx/ , on initial page load everything looks fine, but if you navigate to Stellaric, you will see the bio says "text". If you reload the page, you will see the full bio. If then you click the "back" button on this page, you will see the home screen online has 5 individuals instead of the expected 7.

Essentially it looks like the initial page loads have the correct data (whenever you refresh), but then client navigation between pages has the incorrect (outdated) data. How do I fix this? Why are there different versions of the page being rendered/displayed? Thanks!

9 Replies

Brown bearOP
Both pages are server components (marked with "use server" at the top), and both are performing SQL queries from within the page component body itself. The sub pages for the individual people are a dynamic route (using [...username] as a param definition)
You shouldnt mark server components with use server. They should just have nothing. 'use server' is specifically for API routes.
I dont think thats the issue.... but I would advise against doing that.
btw, really enjoy the dark -> light and vice versa transitions! 🙂
@Jboncz btw, really enjoy the dark -> light and vice versa transitions! 🙂
Brown bearOP
thanks!!

I'll try removing the use server declarations and see if that does anything
Brown bearOP
I think I've fixed this by adding export const revalidate = 60; to the top of my page files
Oh yeah, default caching 😂 That changes with Next15
Brown bearOP
how so? @Jboncz