Quest for Codev2.0.0
/
SIGN IN
next.js/test/e2e/app-dir/instant-validation/app/suspense-in-root/runtime/static-layout-above-runtime-config/layout.tsx
layout.tsx23 lines702 B
import { cookies } from 'next/headers'
import { ReactNode } from 'react'

// This layout calls cookies() without Suspense and has no instant
// config. It sits above a deeper layout with runtime prefetch config.
// From the developer's perspective, they configured runtime prefetching
// deeper in the tree, so cookies() should be fine. But this layout
// gets static prefetching by default (since the config is below it),
// making the cookies() call a blocking violation.
export default async function StaticLayout({
  children,
}: {
  children: ReactNode
}) {
  await cookies()
  return (
    <div>
      <em>Static layout above runtime config (calls cookies)</em>
      {children}
    </div>
  )
}