silverwolf-x's picture
download
raw
1.14 kB
import { Suspense } from 'react'
import { headers } from 'next/headers'
import { getSentinelValue } from '../../getSentinelValue'
/**
* This test case is constructed to demonstrate how using the async form of cookies can lead to a better
* prerender with cache components when PPR is on. There is no difference when PPR is off. When PPR is on the second component
* can finish rendering before the prerender completes and so we can produce a static shell where the Fallback closest
* to Cookies access is read
*/
export default async function Page() {
return (
<Suspense fallback="loading...">
<Suspense fallback="inner loading...">
<Component />
</Suspense>
<ComponentTwo />
<div id="page">{getSentinelValue()}</div>
</Suspense>
)
}
async function Component() {
const hasHeader = (await headers()).has('x-sentinel')
if (hasHeader) {
return (
<div>
header{' '}
<span id="x-sentinel">{(await headers()).get('x-sentinel')}</span>
</div>
)
} else {
return <div>no header found</div>
}
}
function ComponentTwo() {
return <p>footer</p>
}

Xet Storage Details

Size:
1.14 kB
·
Xet hash:
14eb48f3f9702918e5cd011316ec6710d9dcb2af0947c8fcaf395a9c6b38c21e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.