Files
JJ KasperandGitHub 169785253e Fix revalidate for initial notFound: true paths (#28097)
This fixes revalidation not occurring correctly when `notFound: true` is returned during build, additional tests have been added to ensure this is working correctly for dynamic and non-dynamic pages returning `notFound: true` during build and then revalidating afterwards.  

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`

Fixes: https://github.com/vercel/next.js/issues/21453
2021-08-14 13:11:40 +00:00

22 lines
397 B
JavaScript

import fs from 'fs'
import path from 'path'
export async function getStaticProps() {
const data = await fs.promises.readFile(
path.join(process.cwd(), 'data.txt'),
'utf8'
)
console.log('revalidate', { data })
return {
props: { data },
notFound: data.trim() === '404',
revalidate: 1,
}
}
export default function Page({ data }) {
return <p id="data">{data}</p>
}