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
18 lines
431 B
TypeScript
18 lines
431 B
TypeScript
import { after, connection } from 'next/server'
|
|
import { setTimeout } from 'timers/promises'
|
|
|
|
export default async function Page() {
|
|
await connection()
|
|
after(async () => {
|
|
console.log('[after] starting sleep')
|
|
await setTimeout(2500)
|
|
|
|
// make sure that spawning more after tasks works
|
|
after(async () => {
|
|
await setTimeout(2500)
|
|
console.log('[after] finished sleep')
|
|
})
|
|
})
|
|
return <>Hello</>
|
|
}
|