From 18ff185896c194357941b854cffc1367ff04f444 Mon Sep 17 00:00:00 2001 From: Alessandra Vertrees Date: Thu, 5 Dec 2024 10:26:39 -0500 Subject: [PATCH] if endpoint only returns one collection as a hash, force array --- .../components/pages/collectionsPage/collectionsPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/components/pages/collectionsPage/collectionsPage.tsx b/app/src/components/pages/collectionsPage/collectionsPage.tsx index 210e67d1..da2270e2 100644 --- a/app/src/components/pages/collectionsPage/collectionsPage.tsx +++ b/app/src/components/pages/collectionsPage/collectionsPage.tsx @@ -23,10 +23,10 @@ export const CollectionsPage = ({ data }) => { const searchParams = useSearchParams(); const pathname = usePathname(); const [isLoaded, setIsLoaded] = useState(false); - // console.log("typeof data.collection is: ", typeof data.collection) - // console.log(" data.collection.length? ", typeof data.collection?.length) - const collections = data.collection; //typeof data.collection === "array" ? data.collection : [data.collection] //: data.collection // this breaks empty search + const collections = Array.isArray(data.collection) + ? data.collection + : [data.collection]; const headingRef = useRef(null); // pagination