From 28bd4578d270c316af456195188afa9ae44109c7 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 26 Jul 2023 09:40:43 +0800 Subject: [PATCH] Better handle subscriptions returning null or empty --- .../web/components/templates/homeFeed/LibraryFilterMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx b/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx index 893d973aa..d6d300be9 100644 --- a/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx +++ b/packages/web/components/templates/homeFeed/LibraryFilterMenu.tsx @@ -149,7 +149,7 @@ function Subscriptions(props: LibraryFilterMenuProps): JSX.Element { const [viewAll, setViewAll] = useState(false) useRegisterActions( - subscriptions.map((subscription, idx) => { + (subscriptions ?? []).map((subscription, idx) => { const key = String(idx + 1) const name = subscription.name return { @@ -165,7 +165,7 @@ function Subscriptions(props: LibraryFilterMenuProps): JSX.Element { [subscriptions] ) - if (subscriptions.length < 1) { + if (!subscriptions || subscriptions.length < 1) { return <> }