Fix for searching apps when some have no category

This commit is contained in:
Chris Hunt 2023-01-04 09:19:51 +00:00
parent 46c19fedca
commit ca109cbad5

View File

@ -19,9 +19,9 @@ export default function Home({ searchText }) {
const lowerSearch = searchText && searchText.toLowerCase(); const lowerSearch = searchText && searchText.toLowerCase();
if (searchText && searchText !== "") { if (searchText && searchText !== "") {
filteredapps = filteredapps.filter((i) => { filteredapps = filteredapps.filter((i) => {
const category = i.categories.filter((i) => const category = (i.categories && i.categories.length > 0) ? i.categories.filter((i) =>
i.toLowerCase().includes(lowerSearch) i.toLowerCase().includes(lowerSearch)
); ) : [];
return ( return (
i.name.toLowerCase().includes(lowerSearch) || i.name.toLowerCase().includes(lowerSearch) ||
category.length > 0 category.length > 0