Skip to content

Commit 6ce930b

Browse files
committed
feat: add new demo page to test ISR returning notFound
1 parent 0607405 commit 6ce930b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import Link from 'next/link'
2+
3+
const Show = ({ show }) => (
4+
<div>
5+
<p>
6+
This page uses getStaticProps() to pre-fetch a TV show, but will return a 404 if the current time ends in 0-4.
7+
</p>
8+
9+
<hr />
10+
11+
<h1>Show #{show.id}</h1>
12+
<p>{show.name}</p>
13+
14+
<hr />
15+
16+
<Link href="/">
17+
<a>Go back home</a>
18+
</Link>
19+
</div>
20+
)
21+
22+
export async function getStaticProps(context) {
23+
const res = await fetch(`https://api.tvmaze.com/shows/71`)
24+
const data = await res.json()
25+
26+
return {
27+
props: {
28+
show: data,
29+
},
30+
notFound: new Date().getMinutes() % 10 < 5,
31+
revalidate: 60,
32+
}
33+
}
34+
35+
export default Show

0 commit comments

Comments
 (0)