Next.js Discord

Discord Forum

generateDynamicParams invalidates dynamicParams = false when empty

Unanswered
Thai posted this in #help-forum
Open in Discord
Avatar
ThaiOP
We have an optional catch-all route where we use generateStaticParams. We have dynamicParams = false at the top of the page to 404 any pages which aren't returned in generateStaticParams.

If an empty array is returned from generateStaticParams, it seems to invalidate the dynamicParams = false, and begins returning all routes with an empty page, rather than 404ing those pages.

I tested this with the latest version of Next and have an example repo here: https://github.com/JKarlavige/nextjs-app-generateparams-test/blob/main/app/%5B%5B...slug%5D%5D/page.tsx

Does anyone know what the functionality should be if an empty array is returned from generateStaticParams?

0 Replies