The greeting is inside <Suspense>, but the page awaits headers() itself. What does next build say?
The home page greets French speakers in French. It reads the Accept-Language header at the top of the page and passes the language to a Greeting component, which sits inside <Suspense> with a fallback. Cache Components is on, as create-next-app sets it up.
app/layout.tsxexport const metadata = { title: "Leaf and Kettle" };
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
<html lang="en">
<body>
<header>Leaf and Kettle</header>
{children}
</body>
</html>
);
}
app/page.tsximport { Suspense } from "react";
import { headers } from "next/headers";
function Greeting({ language }: { language: string }) {
return <p>{language.startsWith("fr") ? "Bienvenue !" : "Welcome!"}</p>;
}
export default async function Home() {
const language = (await headers()).get("accept-language") ?? "en";
return (
<main>
<h1>Our teas</h1>
<Suspense fallback={<p>Choosing your language…</p>}>
<Greeting language={language} />
</Suspense>
</main>
);
}
It's a project create-next-app made (Next.js 16.4.3, TypeScript, the App Router, and Cache Components on) with these files, built with next build. What happens:
- You run
next build.
The answer
Work out what Next.js does at each step: what the build prints, what each request answers, and what the page shows. Then check.
Checking your sign-in…