From 8530c2cc939ce4ed4b3a8e56ed2bdc25bf4c01f6 Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Mon, 12 May 2025 12:57:40 +0000 Subject: [PATCH] Merged in fix/nullable-dynamic-content-in-static-page-header (pull request #2058) fix: update header dynamic_content schema to allow null values * fix: update header dynamic_content schema to allow null values * fix: update to use nullish Approved-by: Erik Tiekstra --- apps/scandic-web/components/ContentType/StaticPages/index.tsx | 4 +++- .../server/routers/contentstack/contentPage/output.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/scandic-web/components/ContentType/StaticPages/index.tsx b/apps/scandic-web/components/ContentType/StaticPages/index.tsx index bd1582273..e711aa167 100644 --- a/apps/scandic-web/components/ContentType/StaticPages/index.tsx +++ b/apps/scandic-web/components/ContentType/StaticPages/index.tsx @@ -53,7 +53,9 @@ export default async function StaticPage({ {header.navigation_links ? ( ) : null} - {"dynamic_content" in header && header.dynamic_content ? ( + {"dynamic_content" in header && + header.dynamic_content !== null && + header.dynamic_content !== undefined ? ( ) : null} diff --git a/apps/scandic-web/server/routers/contentstack/contentPage/output.ts b/apps/scandic-web/server/routers/contentstack/contentPage/output.ts index 17eb6ebd6..8ccf460f6 100644 --- a/apps/scandic-web/server/routers/contentstack/contentPage/output.ts +++ b/apps/scandic-web/server/routers/contentstack/contentPage/output.ts @@ -214,7 +214,7 @@ export const contentPageSchema = z.object({ preamble: z.string(), top_primary_button: topPrimaryButtonSchema, navigation_links: navigationLinksSchema, - dynamic_content: headerDynamicContentSchema.optional(), + dynamic_content: headerDynamicContentSchema.nullish(), }), meeting_package: z .object({ @@ -330,7 +330,7 @@ const contentPageSidebarRefsItem = z.discriminatedUnion("__typename", [ const contentPageHeaderRefs = z.object({ navigation_links: z.array(linkConnectionRefs), top_primary_button: linkConnectionRefs.nullable(), - dynamic_content: headerDynamicContentRefsSchema.optional(), + dynamic_content: headerDynamicContentRefsSchema.nullish(), }) export const contentPageRefsSchema = z.object({