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
fix: handle the edge cases for alerts create form (#4875)
Vikrant Gupta48e5436167cb
diff --git a/frontend/src/container/CreateAlertRule/index.tsx b/frontend/src/container/CreateAlertRule/index.tsxindex a5924531b2..5a98cd2d8e 100644--- a/frontend/src/container/CreateAlertRule/index.tsx+++ b/frontend/src/container/CreateAlertRule/index.tsx@@ -2,6 +2,7 @@ import { Form, Row } from 'antd';import { ENTITY_VERSION_V4 } from 'constants/app';import FormAlertRules from 'container/FormAlertRules';import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam';+import { isEqual } from 'lodash-es';import { useEffect, useState } from 'react';import { useLocation } from 'react-router-dom';import { AlertTypes } from 'types/api/alerts/alertTypes';@@ -18,9 +19,7 @@ import SelectAlertType from './SelectAlertType';function CreateRules(): JSX.Element {const [initValues, setInitValues] = useState<AlertDef | null>(null);- const [alertType, setAlertType] = useState<AlertTypes>(- AlertTypes.METRICS_BASED_ALERT,- );+ const [alertType, setAlertType] = useState<AlertTypes>();const location = useLocation();const queryParams = new URLSearchParams(location.search);@@ -56,10 +55,10 @@ function CreateRules(): JSX.Element {}const dataSource = compositeQuery?.builder?.queryData[0]?.dataSource;- const alertType = ALERT_TYPE_VS_SOURCE_MAPPING[dataSource];+ const alertTypeFromQuery = ALERT_TYPE_VS_SOURCE_MAPPING[dataSource];- if (alertType) {- onSelectType(alertType);+ if (alertTypeFromQuery && !isEqual(alertType, alertTypeFromQuery)) {+ onSelectType(alertTypeFromQuery);}// eslint-disable-next-line react-hooks/exhaustive-deps}, [compositeQuery]);diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsxindex 9a6fe62a1c..1428e00e21 100644--- a/frontend/src/providers/Dashboard/Dashboard.tsx+++ b/frontend/src/providers/Dashboard/Dashboard.tsx@@ -176,8 +176,6 @@ export function DashboardProvider({return data;};-- console.log(variablesToGetUpdated);const dashboardResponse = useQuery([REACT_QUERY_KEY.DASHBOARD_BY_ID, isDashboardPage?.params],{