From d11f58107fa7d4151006772131d2e7392e879c42 Mon Sep 17 00:00:00 2001 From: Kathrin Holzmann Date: Tue, 12 Nov 2024 09:35:05 +0100 Subject: [PATCH] fix: implement type safety fallback --- packages/website/pages/[...slug].tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/website/pages/[...slug].tsx b/packages/website/pages/[...slug].tsx index 61e3c8ab25..bc265dfb07 100644 --- a/packages/website/pages/[...slug].tsx +++ b/packages/website/pages/[...slug].tsx @@ -295,9 +295,12 @@ export const getStaticPaths: GetStaticPaths = async () => { ?.sectionCollection?.items[0]; } + const sectionSlug = section?.slug ?? 'default-section'; + const itemSlug = item?.slug ?? 'default-item'; const slug = item.authProtected - ? [section.slug, 'protected', item.slug] - : [section.slug, item.slug]; + ? [sectionSlug, 'protected', itemSlug] + : [sectionSlug, itemSlug]; + return { params: { slug,