From 6729bbd80cfb60e11e6e94cad313de48e85c4928 Mon Sep 17 00:00:00 2001 From: Chloe Date: Thu, 4 Jul 2024 09:15:57 +0700 Subject: [PATCH] add check for collection link Signed-off-by: Chloe --- components/layout/search/collection-link.tsx | 4 +++- components/layout/search/header.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/layout/search/collection-link.tsx b/components/layout/search/collection-link.tsx index 2f9e3a667..d38e85880 100644 --- a/components/layout/search/collection-link.tsx +++ b/components/layout/search/collection-link.tsx @@ -7,10 +7,12 @@ const CollectionLink = async ({ anchorText, className }: { - collectionLinkId: string; + collectionLinkId?: string; anchorText: string; className?: string; }) => { + if (!collectionLinkId) return null; + const collection = await getCollection({ id: collectionLinkId }); if (!collection) return null; diff --git a/components/layout/search/header.tsx b/components/layout/search/header.tsx index 5dd9d0664..7059a48c3 100644 --- a/components/layout/search/header.tsx +++ b/components/layout/search/header.tsx @@ -12,7 +12,7 @@ const HelpfulLinks = async ({ ids }: { ids: string[] | null }) => { {links.map((link) => (