Skip to content

Commit

Permalink
fix: skip rendering dynamic root segment routes (vercel#74039)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wyattjoh authored Dec 17, 2024
1 parent 7070f9b commit a471b1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,16 @@ export default async function build(
: undefined

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] = {
page: originalAppPath,
query: { __nextSsgPath: route.encodedPathname },
Expand Down

0 comments on commit a471b1f

Please sign in to comment.