fix: gracefully handle PocketBase unreachable during static generation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ilia Mashkov
2026-05-19 19:27:04 +03:00
parent 93b8adf55d
commit 6b15a0e658
+5 -1
View File
@@ -8,11 +8,15 @@ import { SectionsAccordion } from '$widgets/SectionsAccordion';
* Optional catchall: `/` → first section, `/:slug` → that section.
*/
export async function generateStaticParams() {
try {
const { items: sections } = await getCollection<SectionRecord>('sections', {
sort: 'order',
tags: ['sections'],
});
return [{}, ...sections.map((s) => ({ slug: [s.slug] }))];
} catch (err) {
console.warn('[generateStaticParams] PocketBase unreachable at build — deferring to runtime ISR', err);
return [];
}
}
type Props = {