Unverified Commit a471b1fc authored by Wyatt Johnson's avatar Wyatt Johnson Committed by GitHub

fix: skip rendering dynamic root segment routes (#74039)

Routes that contain dynamic root segments (those where the root
parameter is not known at build time) should not have shells generated.
This is because today there's no way to revalidate the shell for that
page and it would cause cache posioning.
parent 7070f9b6
...@@ -2788,6 +2788,16 @@ export default async function build( ...@@ -2788,6 +2788,16 @@ export default async function build(
: undefined : undefined
routes.forEach((route) => { routes.forEach((route) => {
// If the route has any dynamic root segments, we need to skip
// rendering the route. This is because we don't support
// revalidating the shells without the parameters present.
if (
route.fallbackRootParams &&
route.fallbackRootParams.length > 0
) {
return
}
defaultMap[route.pathname] = { defaultMap[route.pathname] = {
page: originalAppPath, page: originalAppPath,
query: { __nextSsgPath: route.encodedPathname }, query: { __nextSsgPath: route.encodedPathname },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment