[GH-ISSUE #346] renderHTTPAccessFallbackPage does not pass params to layout components #79

Closed
opened 2026-05-06 12:37:03 +02:00 by BreizhHardware · 1 comment

Originally created by @Jbithell on GitHub (Mar 8, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/346

renderHTTPAccessFallbackPage does not pass params to layout components


When vinext renders HTTP access fallback pages (404, 403, 401), layout components are rendered without the params prop, causing layouts that destructure route params to crash with:

Cannot destructure property 'lang' of '(intermediate value)' as it is undefined.

Root cause

In the bundled output, renderHTTPAccessFallbackPage creates layout elements with only { children } and no params:

// renderHTTPAccessFallbackPage path — no params passed
const LayoutComponent = layouts[i3]?.default;
if (LayoutComponent) {
  element = createElement(LayoutComponent, { children: element });
}

The normal render path correctly passes params:

// normal render path — params passed correctly
const layoutProps = { children: element, params: makeThenableParams(params) };

This affects both the RSC and non-RSC branches within renderHTTPAccessFallbackPage.

Reproduction

  1. Create a Next.js app with a dynamic [lang] route segment
  2. In app/[lang]/layout.tsx, destructure lang from params:
export default async function RootLayout({
  params,
  children,
}: {
  params: Promise<{ lang: string }>;
  children: React.ReactNode;
}) {
  const { lang } = await params;
  // use lang...
}
  1. Navigate to any URL that triggers a 404 (e.g. /en/nonexistent-page)
  2. The layout crashes because params is undefined

Expected behavior

renderHTTPAccessFallbackPage should pass params: makeThenableParams(params) to layout components, matching the normal render path.

Workaround

Add nullish coalescing when destructuring params in layouts:

const { lang } = (await params) ?? {};

Environment

  • vinext: ^0.0.22
  • next: 15.5.2
Originally created by @Jbithell on GitHub (Mar 8, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/346 `renderHTTPAccessFallbackPage` does not pass `params` to layout components --- When vinext renders HTTP access fallback pages (404, 403, 401), layout components are rendered without the `params` prop, causing layouts that destructure route params to crash with: ``` Cannot destructure property 'lang' of '(intermediate value)' as it is undefined. ``` ## Root cause In the bundled output, `renderHTTPAccessFallbackPage` creates layout elements with only `{ children }` and no `params`: ```js // renderHTTPAccessFallbackPage path — no params passed const LayoutComponent = layouts[i3]?.default; if (LayoutComponent) { element = createElement(LayoutComponent, { children: element }); } ``` The normal render path correctly passes params: ```js // normal render path — params passed correctly const layoutProps = { children: element, params: makeThenableParams(params) }; ``` This affects both the RSC and non-RSC branches within `renderHTTPAccessFallbackPage`. ## Reproduction 1. Create a Next.js app with a dynamic `[lang]` route segment 2. In `app/[lang]/layout.tsx`, destructure `lang` from `params`: ```tsx export default async function RootLayout({ params, children, }: { params: Promise<{ lang: string }>; children: React.ReactNode; }) { const { lang } = await params; // use lang... } ``` 3. Navigate to any URL that triggers a 404 (e.g. `/en/nonexistent-page`) 4. The layout crashes because `params` is `undefined` ## Expected behavior `renderHTTPAccessFallbackPage` should pass `params: makeThenableParams(params)` to layout components, matching the normal render path. ## Workaround Add nullish coalescing when destructuring params in layouts: ```ts const { lang } = (await params) ?? {}; ``` ## Environment - vinext: `^0.0.22` - next: `15.5.2`
Author
Owner

@james-elicx commented on GitHub (Mar 8, 2026):

I've had the fix for this sat in the big batch of fixes i made for another project. Slowly sifting through them this weekend and trying to make repros for each one before merging...

<!-- gh-comment-id:4019193402 --> @james-elicx commented on GitHub (Mar 8, 2026): I've had the fix for this sat in the big batch of fixes i made for another project. Slowly sifting through them this weekend and trying to make repros for each one before merging...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#79
No description provided.