Files
Janka UrygaandGitHub 08ae81fab6 [Instant] Fix loading.js not being counted as a suspense boundary (#90292)
Fixes a bug where a loading.js isn't properly considered as providing a
suspense boundary for a page. This is because we're placing the boundary
around the segment component itself, but it should be rendered above the
`LoadingBoundary` that is rendered around it (in `OuterLayoutRouter`).

This PR reworks the boundary placement logic to insert the boundary
above ErrorBoundary/LoadingBoundary (but below TemplateContext). It's a
little bit tricky to communicate this from `instant-validation` to the
client router. Instead of placing the boundary directly like before, we
now add a context to the innermost parent segment
(`PlaceValidationBoundaryBelowThisLevel`) and then the
`OuterLayoutRouter`s for the segments below see this context value and
add the validation boundary (`RenderValidationBoundaryAtThisLevel`)
2026-02-25 21:46:31 +01:00

30 lines
628 B
TypeScript

import { cookies } from 'next/headers'
import { connection } from 'next/server'
export default async function Page() {
return (
<main>
<p>
This page doesn't wrap runtime/dynamic components in suspense, but it
has a loading.tsx, so these are fine.
</p>
<div>
<Runtime />
</div>
<div>
<Dynamic />
</div>
</main>
)
}
async function Runtime() {
await cookies()
return <div id="runtime-content">Runtime content from page</div>
}
async function Dynamic() {
await connection()
return <div id="dynamic-content">Dynamic content from page</div>
}