yiekheng 90f8f50166 Enable ISR on list pages; cache reader + search DB queries
Stable image URLs (post-signing removal) make page-level caching
safe again. Homepage, genre page, sitemap, and detail page now
revalidate on an interval instead of running Prisma on every hit.
Reader and search keep dynamic rendering (searchParams) but wrap
their Prisma queries in unstable_cache.

TTLs: home/genre/detail 5m, reader manga 5m, reader page meta 1h
(immutable), search 1m, sitemap 1h.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 20:12:51 +08:00

25 lines
715 B
TypeScript

import { prisma } from "@/lib/db";
import { collectGenres } from "@/lib/genres";
import { TrendingCarousel } from "@/components/TrendingCarousel";
import { GenreTabs } from "@/components/GenreTabs";
export const revalidate = 300;
export default async function Home() {
const manga = await prisma.manga.findMany({
where: { status: "PUBLISHED" },
orderBy: { updatedAt: "desc" },
include: { _count: { select: { chapters: true } } },
});
const trending = manga.slice(0, 10);
const genres = collectGenres(manga);
return (
<div className="max-w-6xl mx-auto px-4 py-5 space-y-8">
<TrendingCarousel manga={trending} />
<GenreTabs manga={manga} genres={genres} />
</div>
);
}