feat: generateStaticParams for application + news slug pages
Deploy to VPS / deploy (push) Has been cancelled
Deploy to VPS / deploy (push) Has been cancelled
Pre-render all known slugs at build time so first visits are instant from cache. New slugs added after deploy render on-demand and get cached by ISR (revalidate=60). try/catch ensures the build never fails if the DB is unreachable during docker build — pages just fall back to on-demand rendering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,9 +83,20 @@ export async function generateMetadata({
|
||||
}
|
||||
}
|
||||
|
||||
// generateStaticParams omitted — slug pages render on-demand and are cached
|
||||
// by ISR (revalidate=60). The DYNAMIC_SERVER_USAGE issue that previously
|
||||
// blocked this is now fixed via setRequestLocale.
|
||||
// Pre-render all known application slugs at build time. New slugs added
|
||||
// after deploy render on-demand and get cached by ISR (revalidate=60).
|
||||
// try/catch ensures the build never fails if the DB is unreachable
|
||||
// during docker build — pages just render on first request instead.
|
||||
export async function generateStaticParams() {
|
||||
try {
|
||||
const apps = await prisma.application.findMany({
|
||||
select: { slug: true },
|
||||
});
|
||||
return apps.map((app) => ({ slug: app.slug }));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 🔥 AHORA RECIBIMOS EL LOCALE DESDE LA URL
|
||||
export default async function ApplicationPage({ params }: { params: Promise<{ slug: string, locale: string }> }) {
|
||||
|
||||
Reference in New Issue
Block a user