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.

fix: graph component is memorised (#2223)

palashgdevb67206dd65ae
diff --git a/frontend/src/components/Graph/index.tsx b/frontend/src/components/Graph/index.tsx
index 2b6435d106..8bc8ee4109 100644
--- a/frontend/src/components/Graph/index.tsx
+++ b/frontend/src/components/Graph/index.tsx
@@ -25,7 +25,8 @@ import * as chartjsAdapter from 'chartjs-adapter-date-fns';
import annotationPlugin from 'chartjs-plugin-annotation';
import dayjs from 'dayjs';
import { useIsDarkMode } from 'hooks/useDarkMode';
-import React, { useCallback, useEffect, useRef } from 'react';
+import isEqual from 'lodash-es/isEqual';
+import React, { memo, useCallback, useEffect, useRef } from 'react';
import { hasData } from './hasData';
import { getAxisLabelColor } from './helpers';
@@ -374,4 +375,7 @@ Graph.defaultProps = {
onDragSelect: undefined,
dragSelectColor: undefined,
};
-export default Graph;
+
+export default memo(Graph, (prevProps, nextProps) =>
+ isEqual(prevProps.data, nextProps.data),
+);