Files
JJ KasperandGitHub 57bb52d37d Fix stale revalidate stream handling (#55978)
This ensures we don't block sending the stream down when handling stale revalidates, in edge runtime we leverage the existing `waitUntil` handling and in node.js runtime we couple this into our pipe readable handling to wait to close the writable until after the promise resolves. 

x-ref: https://github.com/vercel/next.js/issues/54193
2023-09-25 20:50:00 +00:00

21 lines
460 B
TypeScript

export const runtime = 'edge'
const delay = 3000
export default async function Page(props) {
const start = Date.now()
const data = await fetch(
`https://next-data-api-endpoint.vercel.app/api/delay?delay=${delay}`,
{ next: { revalidate: 3 } }
).then((res) => res.json())
const fetchDuration = Date.now() - start
return (
<>
<p id="data">
{JSON.stringify({ fetchDuration, data, now: Date.now() })}
</p>
</>
)
}