diff --git a/frontend/src/container/ListOfDashboard/utils.ts b/frontend/src/container/ListOfDashboard/utils.ts index 199b356581..150aeab6c8 100644 --- a/frontend/src/container/ListOfDashboard/utils.ts +++ b/frontend/src/container/ListOfDashboard/utils.ts @@ -3,16 +3,16 @@ import { Dashboard } from 'types/api/dashboard/getAll'; export const filterDashboard = ( searchValue: string, dashboardList: Dashboard[], -): any[] => { +): Dashboard[] => { // Convert the searchValue to lowercase for case-insensitive search const searchValueLowerCase = searchValue.toLowerCase(); - // Use the filter method to find matching objects return dashboardList.filter((item: Dashboard) => { // Convert each property value to lowercase for case-insensitive search - const itemValues = Object.values(item?.data).map((value) => - value.toString().toLowerCase(), - ); + const itemValues = Object.values(item?.data).map((value) => { + if (value === null || value === undefined) return ''; + return value.toString().toLowerCase(); + }); // Check if any property value contains the searchValue return itemValues.some((value) => value.includes(searchValueLowerCase));