From 98d8f8f678e809c90fbcf3153c865b29121b7996 Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Wed, 24 Apr 2024 11:46:03 +0200 Subject: [PATCH] render collections only if !== undefined --- .../src/features/collections/CollectionsGrid.tsx | 10 +--------- .../src/features/discovery/LandingPage.tsx | 4 +++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/grant-explorer/src/features/collections/CollectionsGrid.tsx b/packages/grant-explorer/src/features/collections/CollectionsGrid.tsx index 728a98d849..bd19f6acbf 100644 --- a/packages/grant-explorer/src/features/collections/CollectionsGrid.tsx +++ b/packages/grant-explorer/src/features/collections/CollectionsGrid.tsx @@ -7,18 +7,10 @@ const collectionGridLayout = [0, 5, 6, 11]; const DISPLAY_COUNT = 12; -export function CollectionsGrid({ - data, -}: { - data: CommunityCollection[] | undefined; -}) { +export function CollectionsGrid({ data }: { data: CommunityCollection[] }) { // Shuffle the collections const shuffled = useMemo(() => shuffle(data), [data]); - if (!data) { - return null; - } - return (
{shuffled?.slice(0, DISPLAY_COUNT).map((collection, i) => { diff --git a/packages/grant-explorer/src/features/discovery/LandingPage.tsx b/packages/grant-explorer/src/features/discovery/LandingPage.tsx index 62d3cfb345..4c844c2564 100644 --- a/packages/grant-explorer/src/features/discovery/LandingPage.tsx +++ b/packages/grant-explorer/src/features/discovery/LandingPage.tsx @@ -46,7 +46,9 @@ const LandingPage = () => { - + {collections.data !== undefined && ( + + )}