mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
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
30 lines
506 B
TypeScript
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
|