Next.js Discord

Discord Forum

Can't Get Page to Be Statically Prerendered

Unanswered
Mandarin fish posted this in #help-forum
Open in Discord
Mandarin fishOP
Hello, I am trying to modify the starter project at https://github.com/robotostudio/turbo-start-sanity to be statically prerendered. The project in question is in the apps/web directory. Each time the page loads, the navbar is loaded in with a skeleton. I want it to be statically rendered. I tried getting rid of the <Suspense> surrounding the <Navbar> component and moving the sanityFetch call into layout.tsx, but it doesn't seem to be working. What am I missing?

3 Replies

In that scenario you can’t.
They’re turning the whole app dynamic by calling draftMode() in the root layout, and this function is a dynamic API, meaning it’ll force you into dynamic rendering.

(await draftMode()).isEnabled…
Also, navbar seems to be fetching the latest data on every request, and i believe that’s the expected behavior they wanted it to have
Mandarin fishOP
I thought that draftMode() just makes a page available to be static or dynamic depending on cookies.

I noticed the thing with the navbar - it's set to render without SSR. I removed that and it seems to work just fine.