Download next.js/test/e2e/app-dir/actions/app/delayed-action/actions.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/delayed-action/actions.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/app/delayed-action/actions.ts
-
curl -L -o actions.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/delayed-action/actions.ts
400 Bytes
| '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') | |
| } | |