diff --git a/client/homebrew/pages/basePages/listPage/listPage.jsx b/client/homebrew/pages/basePages/listPage/listPage.jsx index d986a674e..7ea0699bf 100644 --- a/client/homebrew/pages/basePages/listPage/listPage.jsx +++ b/client/homebrew/pages/basePages/listPage/listPage.jsx @@ -202,9 +202,9 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI const filterTextTest = brewStrings.includes(testString); // Filter by user selected tags - const filterTagTest = filterTags.every((tag)=>{ + const filterTagTest = filterTags.every((tag)=> Array.isArray(brew.tags) && //TODO: brew.tags should be converted to array at load so we don't have to catch it here - brew.tags.some((brewTag)=>brewTag.toLowerCase() == tag.toLowerCase())} + brew.tags.some((brewTag)=>brewTag.toLowerCase() == tag.toLowerCase()) ); return filterTextTest && filterTagTest; @@ -233,28 +233,21 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI }); }; - const renderBrewCollection = (brewCollection)=>{ - if(brewCollection.length === 0) - return ( -
-

No Brews

-
- ); - return _.map(brewCollection, (brewGroup, idx)=>{ - const sortedBrewGroup = sortedBrewCollection[idx]; + const renderBrewCollection = ()=>{ + if(sortedBrewCollection.length === 0) + return

No Brews

; + + return _.map(sortedBrewCollection, (brewGroup, idx)=>{ const visible = groupVisibility[brewGroup.class]; return (<>

{ - toggleBrewCollectionState(brewGroup.class); - }}> + onClick={()=>toggleBrewCollectionState(brewGroup.class)}> {brewGroup.title || 'No Title'}

- - {visible ? renderBrews(sortedBrewGroup.brews) : <>} + {visible ? renderBrews(brewGroup.brews) : <>}
); }); @@ -318,7 +311,6 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI {renderTagsOptions()} ); - }; return ( @@ -328,7 +320,7 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI {renderNav()}
-
{renderBrewCollection(brewCollection)}
+
{renderBrewCollection()}
);