Next.js Discord

Discord Forum

Statically generated pages stop rendering when loaded directly

Answered
Japanese littleneck posted this in #help-forum
Open in Discord
Japanese littleneckOP
I noticed some pages end up in a persistent state of being inaccessible. Next.js renders a blank page. From a working page, I can see the broken page load in the Network tab. X-Nextjs-Cache: HIT or MISS, doesn't matter. I get a 304 Not Modified and the page doesn't load.

If I try to load the page directly, the browser doesn't load at all and the URL is removed from the browser.

I have suspected it's something I'm doing in the root layout but it's difficult to debug. This could be related to an existing issue but I can't really tell for sure https://github.com/vercel/next.js/issues/56018#issuecomment-1740376145

My fix has been to deploy the application with all routes set to 'force-dynamic' but that obviously defeats the benefit of a pre-generated static site.
Answered by DirtyCajunRice | AppDir
it doesnt render the way pages do and will absolutely make weird janky stuff happen
View full answer

14 Replies

Japanese littleneckOP
yeah, some
some in generateStaticParams
generate is fine. layout is not
Japanese littleneckOP
those could be moved to page.tsx
it doesnt render the way pages do and will absolutely make weird janky stuff happen
Answer
Japanese littleneckOP
ok doing that
Japanese littleneckOP
are you also saying that generateStaticParams should live in pages and NOT in layout? All of my generateStaticParams get page slugs from the server and most ended up in layouts. Pages do most of the fetching for individual page components.
Japanese littleneckOP
@DirtyCajunRice | AppDir
bump
Japanese littleneckOP
I can change my app to not require data in layouts. I can see how this might speed things up too, but I don't see how this would fix the original issue.