From 29f7f1c333d02dd400f9fe7598b17de12878aed2 Mon Sep 17 00:00:00 2001 From: Nikita Nek Dudnik Date: Fri, 5 Jun 2020 11:55:08 +0200 Subject: [PATCH] fix: make locations fetching work --- .../src/components/CatalogPage/CatalogPage.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx index 1597ae2135..ce983c991a 100644 --- a/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx +++ b/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx @@ -77,14 +77,13 @@ const CatalogPage: FC<{}> = () => { (location): Location[] => location.filter(loc => !!loc) as Array, ) - .then(location => { - if (isMounted()) return [location]; + .then(locs => { + if (isMounted()) return locs; return []; }); } return []; - }, [value, catalogApi, isMounted]); - + }, [value, catalogApi, isMounted, catalogApi]); const actions = [ (rowData: Component) => ({ icon: GitHub, @@ -139,12 +138,11 @@ const CatalogPage: FC<{}> = () => { titlePreamble={selectedFilter.label} components={ (value && - value.map(val => - envelopeToComponent( - val, - findLocationForEntity(val, locations) ?? undefined, - ), - )) || + value.map(val => { + const loc = + findLocationForEntity(val, locations) ?? undefined; + return envelopeToComponent(val, loc); + })) || [] } loading={loading}