I have a catch-all page that uses dynamic segments:
// /app/[[...segments]]/page.tsx
export function CatchAllPage({params}: CatchAllPageProps) {
...page stuff here
}
When I have cacheComponents disabled, I can return an empty array from generateStaticParams:
export function generateStaticParams() {
return [];
}
This causes NextJs to statically generate each version of the page on the first request. So if someone visits /about, the first time it's loaded dynamically and then subsequent requests get a cached version.
When cacheComponents is enabled, you can't do this as you have to provide at least one set of params to generateStaticParams.
The issue is that I don't know what my params are at build time. They are CMS pages that can be created after the build is complete.
So my question is, when using cache components, is there any way to replicate the behaviour of returning an empty array from generateStaticParams? So that each version of the page is cached after the first request.