Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

refactor: added null check while searching for dashboard (#4421)

Rajat Dabade199d52b39fb7
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));