From a59e5b3742b101ba56ceb755d877701bb5847c89 Mon Sep 17 00:00:00 2001 From: timur Date: Tue, 10 Oct 2023 14:10:06 +0200 Subject: [PATCH] Prevent crashing when no description is available --- src/app/products/[slug]/page.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/products/[slug]/page.tsx b/src/app/products/[slug]/page.tsx index 8b8b5d49e..0e470b830 100644 --- a/src/app/products/[slug]/page.tsx +++ b/src/app/products/[slug]/page.tsx @@ -68,7 +68,7 @@ export default async function Page(props: { params: { slug: string }; searchPara } const firstImage = product.thumbnail; - const description = parser.parse(JSON.parse((product?.description as string) || "{}")); + const description = product?.description ? parser.parse(JSON.parse(product?.description)) : null; const variants = product.variants; const selectedVariantID = searchParams.variant; @@ -131,9 +131,9 @@ export default async function Page(props: { params: { slug: string }; searchPara

{variants && } -
+ {description &&
-
+
}