mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? This PR fixes an issue where pages with fallback route params weren't triggering dynamic resume behavior in PPR (Partial Pre-Rendering). ### Why? When fallback route params exist, the RSC (React Server Components) data is inherently dynamic because the params are encoded into the flight router state. Without this fix, pages with fallback route params would incorrectly be treated as fully static, leading to incorrect behavior. ### How? - Added a check in `app-render.tsx` to ensure that pages with fallback route params (`workStore.fallbackRouteParams.size > 0`) always perform a dynamic resume after the static prerender - Refactored PPR tests to use deterministic sentinel markers (`<\!-- PPR_BOUNDARY_SENTINEL -->`) instead of time-based measurements for more reliable testing - Updated the test utilities to split responses based on the sentinel marker rather than timing delays This ensures that: 1. Pages with fallback route params correctly trigger dynamic behavior 2. PPR tests are more reliable and deterministic 3. The boundary between static and dynamic content is clearly marked in test mode Fixes #
21 lines
457 B
React
21 lines
457 B
React
'use client'
|
|
import { useSelectedLayoutSegments } from 'next/navigation'
|
|
import { Suspense } from 'react'
|
|
|
|
function Dynamic() {
|
|
const segments = useSelectedLayoutSegments()
|
|
|
|
return <div data-slug={segments.join('/')}>{segments.join('/')}</div>
|
|
}
|
|
|
|
export default function Layout({ children }) {
|
|
return (
|
|
<>
|
|
<Suspense fallback={<div data-fallback>Dynamic Loading...</div>}>
|
|
<Dynamic />
|
|
</Suspense>
|
|
{children}
|
|
</>
|
|
)
|
|
}
|