Replies: 1 comment 2 replies
-
Setting export const dynamic = 'force-static' breaks dynamic behavior (no SSR). Not setting it = everything becomes dynamic unless covered by generateStaticParams. New CMS pages are rendered dynamically first (CACHE MISS), but never promoted to static unless you re-build. You want ISR-style promotion: dynamic first, cached on next visit. Recommendation: Use revalidate with ISR (Incremental Static Regeneration)
This allows: Static pages from generateStaticParams() to be built at build time. New pages not in generateStaticParams() to be generated on first request (CACHE MISS), then cached for 60s (CACHE HIT on next visits). Optional Split: Static Wrapper + Dynamic Handler Using a middleware to rewrite to: /static/[[...slugs]] for known slugs (SSG), /dynamic/[[...slugs]] for others (SSR). Or maintain an isDynamicRoute(slug) helper from CMS metadata to selectively control logic inside your route. Important Notes revalidate acts like ISR — it's a good balance between force-static and force-dynamic. Pages with searchParams can still be statically rendered; just don’t depend on searchParams at build time. Experimental: Rendering by condition
Static + dynamic routes --> Use revalidate, not force-* |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi,
Is there any way to have a static generation for X pages and dynamic pages for Y pages.
I’ve this structure right now :
app/[[…slugs]]
Where slugs got mapped from the CMS and generated with
generateStaticParams
.My current issue is, few pages needs access to the
searchParams
for instance (or can be any other thing it doesn’t really matter.When I deploy, all the pages that should have been static are having the CACHE HIT working good, the dynamic one have the CACHE MISS. Expected behavior.
Then I add a new page on the CMS side, CACHE MISS, and CACHE MISS again where this page could be statically generated.
I know there is a
export const dynamic = "force-static"
I tried it, but then the dynamic pages get statically generated, but then when I add a page on the CMS first request CACHE MISS, second one CACHE HIT.
is there a way to have a sort of « dual » possibility for the rendering of the page using that sort of catch all segments ?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions