@@ -4,6 +4,7 @@ import db from '#/lib/db';
44import { Boundary } from '#/ui/boundary' ;
55import { ProductCard } from '#/ui/product-card' ;
66import Link from 'next/link' ;
7+ import { RuntimeLink } from './_components/runtime-link' ;
78
89const PRE_RENDERED_IDS = [ '1' , '2' , '3' ] ;
910
@@ -22,32 +23,30 @@ export default async function Page() {
2223 < p className = "text-sm text-gray-500" >
2324 Products 1–3 are pre-rendered via{ ' ' }
2425 < code className = "text-gray-400" > generateStaticParams</ code > . Products
25- 4–9 are discovered at runtime .
26+ 4–9 use a random slug so each click is a fresh cache miss .
2627 </ p >
2728 < div className = "grid grid-cols-1 gap-6 lg:grid-cols-3" >
28- { products . map ( ( product ) => (
29- < Link
30- key = { product . id }
31- href = { `/partial-fallbacks/ ${ product . id } ` }
32- className = "group"
33- >
34- < ProductCard product = { product } animateEnter = { true } / >
35- < div className = "mt-2 flex items-center gap-2" >
36- < span className = "text-sm font-medium text-gray-300 group-hover:text-gray-100 " >
37- { product . name }
38- </ span >
39- { PRE_RENDERED_IDS . includes ( product . id ) ? (
29+ { products . map ( ( product ) =>
30+ PRE_RENDERED_IDS . includes ( product . id ) ? (
31+ < Link
32+ key = { product . id }
33+ href = { `/partial-fallbacks/ ${ product . id } ` }
34+ className = "group"
35+ >
36+ < ProductCard product = { product } animateEnter = { true } / >
37+ < div className = "mt-2 flex items-center gap-2 " >
38+ < span className = "text-sm font-medium text-gray-300 group-hover:text-gray-100" >
39+ { product . name }
40+ </ span >
4041 < span className = "rounded-full bg-green-900/50 px-2 py-0.5 text-[10px] font-medium text-green-400" >
4142 pre-rendered
4243 </ span >
43- ) : (
44- < span className = "rounded-full bg-orange-900/50 px-2 py-0.5 text-[10px] font-medium text-orange-400" >
45- runtime
46- </ span >
47- ) }
48- </ div >
49- </ Link >
50- ) ) }
44+ </ div >
45+ </ Link >
46+ ) : (
47+ < RuntimeLink key = { product . id } product = { product } />
48+ ) ,
49+ ) }
5150 </ div >
5251 </ div >
5352 </ Boundary >
0 commit comments