Download next.js/packages/next/src/client/components/handle-isr-error.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/client/components/handle-isr-error.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/client/components/handle-isr-error.tsx
-
curl -L -o handle-isr-error.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/client/components/handle-isr-error.tsx
672 Bytes
| const workAsyncStorage = | |
| typeof window === 'undefined' | |
| ? ( | |
| require('../../server/app-render/work-async-storage.external') as typeof import('../../server/app-render/work-async-storage.external') | |
| ).workAsyncStorage | |
| : undefined | |
| // if we are revalidating we want to re-throw the error so the | |
| // function crashes so we can maintain our previous cache | |
| // instead of caching the error page | |
| export function HandleISRError({ error }: { error: any }) { | |
| if (workAsyncStorage) { | |
| const store = workAsyncStorage.getStore() | |
| if (store?.isRevalidate || store?.isStaticGeneration) { | |
| console.error(error) | |
| throw error | |
| } | |
| } | |
| return null | |
| } | |