mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Returning an empty array from `generateStaticParams` should still be deployed as an ISR route to support the `dynamicParams = true` case, where a route can be generated & cached on demand. At the moment the only way to achieve this behavior is with `export const dynamic = 'force-static'`. As a result, these routes are being treated as dynamic and never return a cached response. This PR resolves the bug by fixing several distinct things: - `prerenderedRoutes` does not need to be an array > 0 to mark a route as being a static path. This will ensure the build output shows the correct symbol and adds the path to the list of prerenders. - we initialize `prerenderedRoutes` to an empty array if we determine that the leaf-most segment (the thing rendering the current page) has a `generateStaticParams` function - the function responsible for collecting segments associated with a page only considered the `children` branch, but for something like a parallel/interception route, those segments would be inside of a different parallel route key - the regex for determining if a function was dynamic didn't consider that the dynamic route might also contain an interception marker (eg `(.)`) This appears to have regressed in #68125 Closes NEXT-3905 --------- Co-authored-by: Wyatt Johnson <[email protected]>
25 lines
435 B
TypeScript
25 lines
435 B
TypeScript
import { Suspense } from 'react'
|
|
|
|
export default async function Page({
|
|
params,
|
|
}: {
|
|
params: Promise<{ slug: string }>
|
|
}) {
|
|
return (
|
|
<div>
|
|
Hello World
|
|
<div>
|
|
<Params params={params} />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
async function Params({ params }: { params: Promise<{ slug: string }> }) {
|
|
return <Suspense>{(await params).slug}</Suspense>
|
|
}
|
|
|
|
export async function generateStaticParams() {
|
|
return []
|
|
}
|