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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
refactor: added check for dashboard length (#2997)
Rajat Dabadec0d10f0d8899
diff --git a/frontend/src/lib/dashbaordVariables/getDashboardVariables.ts b/frontend/src/lib/dashbaordVariables/getDashboardVariables.tsindex aa870f9bbb..1fae298675 100644--- a/frontend/src/lib/dashbaordVariables/getDashboardVariables.ts+++ b/frontend/src/lib/dashbaordVariables/getDashboardVariables.ts@@ -7,24 +7,27 @@ export const getDashboardVariables = (): Record<string, unknown> => {globalTime,dashboards: { dashboards },} = store.getState();- const [selectedDashboard] = dashboards || [];- const {- data: { variables = {} },- } = selectedDashboard;+ if (dashboards.length > 0) {+ const [selectedDashboard] = dashboards || [];+ const {+ data: { variables = {} },+ } = selectedDashboard;- const { start, end } = getStartEndRangeTime({- type: 'GLOBAL_TIME',- interval: globalTime.selectedTime,- });+ const { start, end } = getStartEndRangeTime({+ type: 'GLOBAL_TIME',+ interval: globalTime.selectedTime,+ });- const variablesTuple: Record<string, unknown> = {- SIGNOZ_START_TIME: parseInt(start, 10) * 1e3,- SIGNOZ_END_TIME: parseInt(end, 10) * 1e3,- };- Object.keys(variables).forEach((key) => {- variablesTuple[key] = variables[key].selectedValue;- });- return variablesTuple;+ const variablesTuple: Record<string, unknown> = {+ SIGNOZ_START_TIME: parseInt(start, 10) * 1e3,+ SIGNOZ_END_TIME: parseInt(end, 10) * 1e3,+ };+ Object.keys(variables).forEach((key) => {+ variablesTuple[key] = variables[key].selectedValue;+ });+ return variablesTuple;+ }+ return {};} catch (e) {console.error(e);}