From 4c0754b455fb77fb68fdeb474777a8c348d7fffb Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Mon, 27 Mar 2023 17:33:48 +0300 Subject: [PATCH] fix: dynamic pages to return null when document is not found LIIKUNTA-441. Return null to fix SSR rendering when the getSTaticProps returns with notFound: true. This is null-checker fix is needed only with fallback: true -option on, but should not be needed at all. The fallback: 'blocking' hides the issue and makes it all work better. --- apps/events-helsinki/src/pages/articles/[...slug].tsx | 4 ++++ apps/events-helsinki/src/pages/pages/[...slug].tsx | 4 ++++ apps/hobbies-helsinki/src/pages/articles/[...slug].tsx | 4 ++++ apps/hobbies-helsinki/src/pages/pages/[...slug].tsx | 5 +++++ apps/sports-helsinki/src/pages/articles/[...slug].tsx | 4 ++++ apps/sports-helsinki/src/pages/pages/[...slug].tsx | 5 +++++ 6 files changed, 26 insertions(+) diff --git a/apps/events-helsinki/src/pages/articles/[...slug].tsx b/apps/events-helsinki/src/pages/articles/[...slug].tsx index 742ec549e..dd536b019 100644 --- a/apps/events-helsinki/src/pages/articles/[...slug].tsx +++ b/apps/events-helsinki/src/pages/articles/[...slug].tsx @@ -56,6 +56,10 @@ const NextCmsArticle: NextPage<{ const { footerMenu } = useContext(NavigationContext); + // FIXME: Return null to fix SSR rendering for notFound-page. + // This is needed only with fallback: true, but should not be needed at all. + if (!article) return null; + return (