mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
We're splitting the test app routes between two root layouts, one for (partially) static pages that does not wrap its children in a Suspense boundary, and one for dynamic pages that adds a Suspense boundary above `body`, which opts those pages into fully dynamic rendering. Two tests are expected to fail for now, because they revealed bugs related to revalidation, which will be fixed in follow-up PRs: - https://github.com/vercel/next.js/pull/81611 - https://github.com/vercel/next.js/pull/81621 closes NAR-171
34 lines
684 B
TypeScript
34 lines
684 B
TypeScript
import { Suspense } from 'react'
|
|
import { cookies, headers } from 'next/headers'
|
|
import { connection } from 'next/server'
|
|
|
|
export const metadata = {
|
|
title: 'Next.js',
|
|
description: 'Generated by Next.js',
|
|
}
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
return (
|
|
<html lang="en">
|
|
<body>
|
|
{children}
|
|
<Suspense>
|
|
<HangingCalls />
|
|
</Suspense>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|
|
|
|
async function HangingCalls() {
|
|
// We purposely do not await these to prevent React from suppressing the rejection error
|
|
cookies().then(() => {})
|
|
headers().then(() => {})
|
|
connection().then(() => {})
|
|
return null
|
|
}
|