diff --git a/packages/next/client/components/react-dev-overlay/internal/container/RootLayoutError.tsx b/packages/next/client/components/react-dev-overlay/internal/container/RootLayoutError.tsx index e9d9648b87f67..5e68fb856175e 100644 --- a/packages/next/client/components/react-dev-overlay/internal/container/RootLayoutError.tsx +++ b/packages/next/client/components/react-dev-overlay/internal/container/RootLayoutError.tsx @@ -14,7 +14,7 @@ export type RootLayoutErrorProps = { missingTags: string[] } export const RootLayoutError: React.FC = function BuildError({ missingTags }) { const message = - 'Please make sure to include the following tags in your root layout: , .\n\n' + + 'Please make sure to include the following tags in your root layout: , , .\n\n' + `Missing required root layout tag${ missingTags.length === 1 ? '' : 's' }: ` + diff --git a/packages/next/server/node-web-streams-helper.ts b/packages/next/server/node-web-streams-helper.ts index c82ff473824f2..a2062a66778f2 100644 --- a/packages/next/server/node-web-streams-helper.ts +++ b/packages/next/server/node-web-streams-helper.ts @@ -288,15 +288,19 @@ export function createRootLayoutValidatorStream( getTree: () => FlightRouterState ): TransformStream { let foundHtml = false + let foundHead = false let foundBody = false return new TransformStream({ async transform(chunk, controller) { - if (!foundHtml || !foundBody) { + if (!foundHtml || !foundHead || !foundBody) { const content = decodeText(chunk) if (!foundHtml && content.includes(' { expect(await hasRedbox(browser, true)).toBe(true) expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` - "Please make sure to include the following tags in your root layout: , . + "Please make sure to include the following tags in your root layout: , , . - Missing required root layout tags: html, body" + Missing required root layout tags: html, head, body" `) }) @@ -54,9 +54,9 @@ describe('app-dir root layout', () => { expect(await hasRedbox(browser, true)).toBe(true) expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` - "Please make sure to include the following tags in your root layout: , . + "Please make sure to include the following tags in your root layout: , , . - Missing required root layout tags: html, body" + Missing required root layout tags: html, head, body" `) }) @@ -67,9 +67,9 @@ describe('app-dir root layout', () => { expect(await hasRedbox(browser, true)).toBe(true) expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` - "Please make sure to include the following tags in your root layout: , . + "Please make sure to include the following tags in your root layout: , , . - Missing required root layout tags: html, body" + Missing required root layout tags: html, head, body" `) }) }) diff --git a/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js b/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js index 7519206f5c7b3..f8fd9c6d9b3ea 100644 --- a/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js +++ b/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js @@ -4,6 +4,9 @@ export const revalidate = 0 export default function Root({ children }) { return ( + + Hello World + {children} )