Files
JJ KasperandGitHub 9697bcd3c8 Fix notFound status code with ISR in app (#55542)
This ensures we properly set/restore the status code with ISR paths in
app router so that when we set the 404 status code with `notFound` it is
persisted properly.

Fixes: https://github.com/vercel/next.js/issues/43831
Closes: https://github.com/vercel/next.js/issues/48342
x-ref:
https://github.com/vercel/next.js/issues/49387#issuecomment-1722575969
2023-09-18 14:35:00 -05:00

30 lines
506 B
TypeScript

import { notFound } from 'next/navigation'
export interface Props {
params: {
slug: string
}
}
const Article = ({ params }: Props) => {
const { slug } = params
if (slug !== 'works') {
return notFound()
}
return <div>Articles page with slug</div>
}
export const revalidate = 1
export const dynamicParams = true
export async function generateStaticParams() {
return [
{
slug: 'works', // Anything not this should be a 404 with no ISR
},
]
}
export default Article