From 5ebfae132b9648847c41d8556e829b2782a7146c Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Tue, 13 Feb 2024 12:41:08 +0100 Subject: [PATCH] Javascript error when searching applications --- client/src/components/Entities.jsx | 13 ++++--------- client/src/tabs/Applications.js | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/client/src/components/Entities.jsx b/client/src/components/Entities.jsx index 2ff6e8fd..ede51f37 100644 --- a/client/src/components/Entities.jsx +++ b/client/src/components/Entities.jsx @@ -5,9 +5,7 @@ import {isEmpty} from "../utils/Utils"; import {sortObjects, valueForSort} from "../utils/Sort"; import {headerIcon} from "../utils/Forms"; import "./Entities.scss"; -import {Button, Loader, Tooltip} from "@surfnet/sds"; - -import {Pagination} from "@surfnet/sds"; +import {Button, Loader, Pagination, Tooltip} from "@surfnet/sds"; import {pageCount} from "../utils/Pagination"; import {useNavigate} from "react-router-dom"; @@ -117,13 +115,10 @@ export const Entities = ({ return entities; } const queryLower = newQuery.toLowerCase(); - return entities.filter(entity => { - return searchAttributes.some(attr => { + return entities.filter(entity => searchAttributes.some(attr => { const val = valueForSort(attr, entity); - return val.toLowerCase().indexOf(queryLower) > -1 - }); - }); - + return isEmpty(val) ? false : val.toLowerCase().indexOf(queryLower) > -1 + })); }; const setSortedKey = key => { diff --git a/client/src/tabs/Applications.js b/client/src/tabs/Applications.js index bcce1a16..82258599 100644 --- a/client/src/tabs/Applications.js +++ b/client/src/tabs/Applications.js @@ -31,7 +31,7 @@ const Applications = () => { role.logo = providerLogoById(role.applicationMaps, providers); role.provider = providerById(role.applicationMaps, providers); role.provisioning = provisioningsByProviderId(role.applicationMaps, provisionings); - }) + }); setRoles(res[1]); setLoading(false); })