mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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
22 lines
397 B
JavaScript
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>
|
|
}
|