From 6b15a0e65899faa6e914f06a0393bbec124000b8 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 19 May 2026 19:27:04 +0300 Subject: [PATCH] fix: gracefully handle PocketBase unreachable during static generation Co-Authored-By: Claude Sonnet 4.6 --- app/[[...slug]]/page.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/[[...slug]]/page.tsx b/app/[[...slug]]/page.tsx index 6cc7a73..4fa0ef0 100644 --- a/app/[[...slug]]/page.tsx +++ b/app/[[...slug]]/page.tsx @@ -8,11 +8,15 @@ import { SectionsAccordion } from '$widgets/SectionsAccordion'; * Optional catchall: `/` → first section, `/:slug` → that section. */ export async function generateStaticParams() { - const { items: sections } = await getCollection('sections', { - sort: 'order', - tags: ['sections'], - }); - return [{}, ...sections.map((s) => ({ slug: [s.slug] }))]; + try { + const { items: sections } = await getCollection('sections', { + sort: 'order', + }); + return [{}, ...sections.map((s) => ({ slug: [s.slug] }))]; + } catch (err) { + console.warn('[generateStaticParams] PocketBase unreachable at build — deferring to runtime ISR', err); + return []; + } } type Props = {