Dynamic params without static params expected behaviour : ISR or dynamic rendering?
Answered
Eric Burel posted this in #help-forum
Hi,
I have a dynamic product page "/product/[pid]/", without any static params
Previously accessing a product like "/product/1" would trigger incremental static rendering, so the page "1" would be cached and never rerendered
I feel like now, it uses per-request server-side rendering, is it true? Has there been a change since Next 14 in this area?
The docs are not super explicit, normally it should be more similar to ISR if I leave revalidate to false or set it to a number but I feel like I got per-request dynamic rendering
(docs: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate)
I have a dynamic product page "/product/[pid]/", without any static params
Previously accessing a product like "/product/1" would trigger incremental static rendering, so the page "1" would be cached and never rerendered
I feel like now, it uses per-request server-side rendering, is it true? Has there been a change since Next 14 in this area?
The docs are not super explicit, normally it should be more similar to ISR if I leave revalidate to false or set it to a number but I feel like I got per-request dynamic rendering
(docs: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate)
Answered by Eric Burel
Found the answer, there are 2 scenarios:
- generateStaticParams is not defined => dynamic rendering
- generateStaticParams is defined and returns an empty array => incremental rendering with caching
I did forgot that setting generateStaticParams with an empty array had this effect
- generateStaticParams is not defined => dynamic rendering
- generateStaticParams is defined and returns an empty array => incremental rendering with caching
I did forgot that setting generateStaticParams with an empty array had this effect
3 Replies
Found the answer, there are 2 scenarios:
- generateStaticParams is not defined => dynamic rendering
- generateStaticParams is defined and returns an empty array => incremental rendering with caching
I did forgot that setting generateStaticParams with an empty array had this effect
- generateStaticParams is not defined => dynamic rendering
- generateStaticParams is defined and returns an empty array => incremental rendering with caching
I did forgot that setting generateStaticParams with an empty array had this effect
Answer
also generateStaticParams returns an empty array + revlidate=0 will instead use dynamic rendering
Yes, the case of generateStaticParams returning [] is consistent with the pages router where getStaticPaths returning [] will dynamically render a slug on first request and cache it thereafter