File size: 400 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use server'
import { unstable_expirePath } from 'next/cache'
import { redirect } from 'next/navigation'

export const action = async () => {
  console.log('revalidating')
  unstable_expirePath('/delayed-action', 'page')
  return Math.random()
}

export const redirectAction = async () => {
  // sleep for 500ms
  await new Promise((res) => setTimeout(res, 500))
  redirect('/delayed-action/node')
}