mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
- rename `unstable_after` -> `after` - remove `experimental.after` flag (and warn if it's present) i separated the big find-and-replace into a separate commit so that it's easier to see what else changed apart from that. does not touch docs, that's in #73038
31 lines
729 B
JavaScript
31 lines
729 B
JavaScript
import { Suspense } from 'react'
|
|
import { after } from 'next/server'
|
|
import { cliLog } from '../../../utils/log'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export default async function Page() {
|
|
after(() => {
|
|
cliLog({ source: '[page] /delay (Page)' })
|
|
})
|
|
return (
|
|
<Suspense fallback={'Loading...'}>
|
|
<Inner>Delay</Inner>
|
|
</Suspense>
|
|
)
|
|
}
|
|
|
|
async function Inner({ children }) {
|
|
after(() => {
|
|
cliLog({ source: '[page] /delay (Inner)' })
|
|
})
|
|
|
|
// the test intercepts this to assert on whether the after() callbacks ran
|
|
// before and after we finish handling the request.
|
|
await fetch('https://example.test/delayed-request', {
|
|
signal: AbortSignal.timeout(10_000),
|
|
})
|
|
|
|
return <>{children}</>
|
|
}
|