next.js
a46ff7c8 - Error when accessing undefined root params in `generateStaticParams` (#91519)

Commit
51 days ago
Error when accessing undefined root params in `generateStaticParams` (#91519) Follow-up to #91189 which added support for accessing root params inside `generateStaticParams`. Previously, if a `generateStaticParams` function tried to read a root param that hasn't been defined yet — either because the current segment is supposed to define it, or because a child segment defines it — `getRootParam` would silently return `undefined`. This is especially problematic because #91019 will type root param getters as `Promise<string>` without `undefined`, making this a silent type safety violation. This change makes `getRootParam` throw an explicit error with the `generate-static-params` work unit store when the requested param is not present in `rootParams`.
Author
Parents
Loading