From c7360a7545c8012679608299b8aa0f0fda065dae Mon Sep 17 00:00:00 2001 From: Mikael Brevik Date: Tue, 3 Dec 2024 08:24:33 +0100 Subject: [PATCH] fix: safe guard contact box in case of no contact points --- src/components/sections/contact-box/ContactSelector.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/sections/contact-box/ContactSelector.tsx b/src/components/sections/contact-box/ContactSelector.tsx index e9936b78d..01e988a7f 100644 --- a/src/components/sections/contact-box/ContactSelector.tsx +++ b/src/components/sections/contact-box/ContactSelector.tsx @@ -30,9 +30,13 @@ export default function ContactSelector({ const contactPoints = use(contactPointsPromise); const [selectedTag, setSelectedTag] = useState( - contactPoints[0].tagSlug, + contactPoints[0]?.tagSlug, ); + if (!contactPoints.length) { + return null; + } + return (