Next.js Discord

Discord Forum

Can you have a dynamic layout with a static page? | v14

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
I have a next app where you need to sign in to access a dashboard.

In the middleware is checked if the user can access the dashboard.

The dashboard itself is a layout that dynamically fetches the user to show the avatar.

The layout contains a page that I want to render statically because of long loading data.

Is this possible?

Right now when I force the page to be
export const dynamic = "force-static"
then also the layout is static with no user data available.

16 Replies

Avatar
you know the point already - no user data at build time for your static page
Avatar
Barbary LionOP
but cant your page be static with a dynamic layout?
Avatar
seems like you need PPR
Avatar
Barbary LionOP
So this is only possible in the future with PPR
Avatar
but it's not an entirely static page
partially static and partially dynamic
Avatar
Barbary LionOP
At this time, the route full cache also includes the layouts?
full route cache*
Avatar
I think full route cache is a different thing
Avatar
Barbary LionOP
Yes sorry, this question has nothing to do with PPR. I mean at this point in time, the full route cache litterally caches the whole page including the layouts.
this will help you get correct understanding
Avatar
Barbary LionOP
Thanks, but I already have read this, they said nothing about layouts except in client side, but this has nothing to do with that.
Avatar
yeah ofc it includes the layouts as well
The default behavior of Next.js is to cache the rendered result (React Server Component Payload and HTML) of a route on the server. This applies to statically rendered routes at build time, or during revalidation.
Avatar
Yes you can, although everything will be static, you will need to leverage client side components to heavy lift the dynamic part