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
feat: fixed multiple sentry error around dashboards (#8148)
SagarRajput-7cd4df6280f29
diff --git a/frontend/src/AppRoutes/Private.tsx b/frontend/src/AppRoutes/Private.tsxindex 9c9719694b..e761c8cf43 100644--- a/frontend/src/AppRoutes/Private.tsx+++ b/frontend/src/AppRoutes/Private.tsx@@ -78,7 +78,7 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {const checkFirstTimeUser = useCallback((): boolean => {const users = usersData?.data || [];- const remainingUsers = users.filter(+ const remainingUsers = (Array.isArray(users) ? users : []).filter((user) => user.email !== '[email protected]',);diff --git a/frontend/src/components/Uplot/Uplot.tsx b/frontend/src/components/Uplot/Uplot.tsxindex af6e28ddf3..cd9ece5212 100644--- a/frontend/src/components/Uplot/Uplot.tsx+++ b/frontend/src/components/Uplot/Uplot.tsx@@ -26,6 +26,18 @@ export interface UplotProps {resetScales?: boolean;}+function isAlignedData(data: unknown): data is uPlot.AlignedData {+ return Array.isArray(data) && data.length > 0;+}++function isUplotOptions(options: unknown): options is uPlot.Options {+ return options !== null && typeof options === 'object';+}++function isHTMLElement(el: unknown): el is HTMLElement {+ return el instanceof HTMLElement;+}+const Uplot = forwardRef<ToggleGraphProps | undefined, UplotProps>(({ options, data, onDelete, onCreate, resetScales = true },@@ -78,6 +90,19 @@ const Uplot = forwardRef<ToggleGraphProps | undefined, UplotProps>(};}+ if (+ !isUplotOptions(propOptionsRef.current) ||+ !isAlignedData(propDataRef.current) ||+ !isHTMLElement(targetRef.current)+ ) {+ console.error('Uplot: Invalid options, data, or target element', {+ options: propOptionsRef.current,+ data: propDataRef.current,+ target: targetRef.current,+ });+ return;+ }+const newChart = new UPlot(propOptionsRef.current,propDataRef.current,diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsxindex 6020705d62..95a76b233d 100644--- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx+++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx@@ -246,7 +246,11 @@ function WidgetGraphComponent({const graphClick = useGraphClickToShowButton({graphRef: currentGraphRef?.current ? currentGraphRef : graphRef,- isButtonEnabled: (widget?.query?.builder?.queryData ?? []).some(+ isButtonEnabled: (widget?.query?.builder?.queryData &&+ Array.isArray(widget.query.builder.queryData)+ ? widget.query.builder.queryData+ : []+ ).some((q) =>q.dataSource === DataSource.TRACES || q.dataSource === DataSource.LOGS,),diff --git a/frontend/src/container/GridCardLayout/GridCard/utils.ts b/frontend/src/container/GridCardLayout/GridCard/utils.tsindex 9a605938d1..5397e63421 100644--- a/frontend/src/container/GridCardLayout/GridCard/utils.ts+++ b/frontend/src/container/GridCardLayout/GridCard/utils.ts@@ -31,7 +31,9 @@ export const getLocalStorageGraphVisibilityState = ({name: string;}): GraphVisibilityLegendEntryProps => {const visibilityStateAndLegendEntry: GraphVisibilityLegendEntryProps = {- graphVisibilityStates: Array(apiResponse.length + 1).fill(true),+ graphVisibilityStates: Array(+ (Array.isArray(apiResponse) ? apiResponse.length : 0) + 1,+ ).fill(true),legendEntry: [{label: 'Timestamp',diff --git a/frontend/src/container/GridCardLayout/GridCardLayout.tsx b/frontend/src/container/GridCardLayout/GridCardLayout.tsxindex 93f3c4e49c..c42bbda450 100644--- a/frontend/src/container/GridCardLayout/GridCardLayout.tsx+++ b/frontend/src/container/GridCardLayout/GridCardLayout.tsx@@ -399,12 +399,14 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {};const handleDragStop: ItemCallback = (_, oldItem, newItem): void => {- if (currentPanelMap[oldItem.i]) {+ if (oldItem?.i && currentPanelMap?.[oldItem.i]) {const differenceY = newItem.y - oldItem.y;- const widgetsInsideRow = currentPanelMap[oldItem.i].widgets.map((w) => ({- ...w,- y: w.y + differenceY,- }));+ const widgetsInsideRow = (currentPanelMap[oldItem.i]?.widgets ?? []).map(+ (w) => ({+ ...w,+ y: w.y + differenceY,+ }),+ );setCurrentPanelMap((prev) => ({...prev,[oldItem.i]: {diff --git a/frontend/src/container/GridCardLayout/utils.ts b/frontend/src/container/GridCardLayout/utils.tsindex f22c9e819e..76099086e4 100644--- a/frontend/src/container/GridCardLayout/utils.ts+++ b/frontend/src/container/GridCardLayout/utils.ts@@ -102,11 +102,11 @@ export function updateStepInterval(return {...query,builder: {- ...query.builder,+ ...query?.builder,queryData: [- ...query.builder.queryData.map((queryData) => ({+ ...(query?.builder?.queryData ?? []).map((queryData) => ({...queryData,- stepInterval: stepIntervalPoints || queryData.stepInterval || 60,+ stepInterval: stepIntervalPoints || queryData?.stepInterval || 60,})),],},diff --git a/frontend/src/container/GridTableComponent/utils.ts b/frontend/src/container/GridTableComponent/utils.tsindex 52a4a7810b..08e99e904c 100644--- a/frontend/src/container/GridTableComponent/utils.ts+++ b/frontend/src/container/GridTableComponent/utils.ts@@ -110,24 +110,24 @@ export function getQueryLegend(switch (currentQuery.queryType) {case EQueryType.QUERY_BUILDER:// check if the value is present in the queries- legend = currentQuery.builder.queryData.find(+ legend = currentQuery?.builder?.queryData?.find((query) => query.queryName === queryName,)?.legend;if (!legend) {// check if the value is present in the formula- legend = currentQuery.builder.queryFormulas.find(+ legend = currentQuery?.builder?.queryFormulas?.find((query) => query.queryName === queryName,)?.legend;}break;case EQueryType.CLICKHOUSE:- legend = currentQuery.clickhouse_sql.find(+ legend = currentQuery?.clickhouse_sql?.find((query) => query.name === queryName,)?.legend;break;case EQueryType.PROM:- legend = currentQuery.promql.find((query) => query.name === queryName)+ legend = currentQuery?.promql?.find((query) => query.name === queryName)?.legend;break;default:diff --git a/frontend/src/container/LogDetailedView/utils.tsx b/frontend/src/container/LogDetailedView/utils.tsxindex 77f765a85e..6f04bd2ca1 100644--- a/frontend/src/container/LogDetailedView/utils.tsx+++ b/frontend/src/container/LogDetailedView/utils.tsx@@ -280,7 +280,7 @@ export const parseFieldValue = (value: string): string => {// now we do not want to render colors everywhere like in tooltip and monaco editor hence we remove such codes to make// the log line readableexport const removeEscapeCharacters = (str: string): string =>- str+ (str ?? '').replace(/\\x1[bB][[0-9;]*m/g, '').replace(/\\u001[bB][[0-9;]*m/g, '').replace(/\\x[0-9A-Fa-f]{2}/g, '')@@ -292,7 +292,7 @@ export const removeEscapeCharacters = (str: string): string =>//// so we need to remove this escapes to render the color properlyexport const unescapeString = (str: string): string =>- str+ (str ?? '').replace(/\\n/g, '\n') // Replaces escaped newlines.replace(/\\r/g, '\r') // Replaces escaped carriage returns.replace(/\\t/g, '\t') // Replaces escaped tabsdiff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsxindex c1b9d772c2..434ae03031 100644--- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx+++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/VariableItem/VariableItem.tsx@@ -185,7 +185,7 @@ function VariableItem({if (details.error) {let message = details.error;- if (details.error.includes('Syntax error:')) {+ if ((details.error ?? '').toString().includes('Syntax error:')) {message ='Please make sure query is valid and dependent variables are selected';}diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsxindex d0077e08f4..4b3a7f25af 100644--- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx+++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx@@ -116,14 +116,14 @@ function DashboardVariableSelection(): JSX.Element | null {const oldVariables = prev?.data.variables;// this is added to handle case where we have two different// schemas for variable response- if (oldVariables[id]) {+ if (oldVariables?.[id]) {oldVariables[id] = {...oldVariables[id],selectedValue: value,allSelected,};}- if (oldVariables[name]) {+ if (oldVariables?.[name]) {oldVariables[name] = {...oldVariables[name],selectedValue: value,diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsxindex bbedc73ad8..461e691940 100644--- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx+++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx@@ -229,7 +229,7 @@ function VariableItem({if (details.error) {let message = details.error;- if (details.error.includes('Syntax error:')) {+ if ((details.error ?? '').toString().includes('Syntax error:')) {message ='Please make sure query is valid and dependent variables are selected';}diff --git a/frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts b/frontend/src/container/NewDashboard/DashboardVariablesSelection/util.tsindex b1f0d8b628..3abd691893 100644--- a/frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts+++ b/frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts@@ -117,6 +117,9 @@ export const buildParentDependencyGraph = (Object.entries(graph).forEach(([node, children]) => {// For each child, add the current node as its parentchildren.forEach((child) => {+ if (!parentGraph[child]) {+ parentGraph[child] = [];+ }parentGraph[child].push(node);});});diff --git a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsxindex f142bd7043..c0ad4c8aae 100644--- a/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx+++ b/frontend/src/container/NewWidget/LeftContainer/WidgetGraph/WidgetGraphs.tsx@@ -125,7 +125,11 @@ function WidgetGraph({// context redirection to explorer pagesconst graphClick = useGraphClickToShowButton({graphRef,- isButtonEnabled: (selectedWidget?.query?.builder?.queryData ?? []).some(+ isButtonEnabled: (selectedWidget?.query?.builder?.queryData &&+ Array.isArray(selectedWidget.query.builder.queryData)+ ? selectedWidget.query.builder.queryData+ : []+ ).some((q) =>q.dataSource === DataSource.TRACES || q.dataSource === DataSource.LOGS,),diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsxindex 9b1e33692d..8d5c159cd6 100644--- a/frontend/src/container/NewWidget/index.tsx+++ b/frontend/src/container/NewWidget/index.tsx@@ -144,7 +144,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {widgetId: selectedWidget?.id,dashboardName: selectedDashboard?.data.title,isNewPanel: !!isWidgetNotPresent,- dataSource: currentQuery.builder.queryData?.[0]?.dataSource,+ dataSource: currentQuery?.builder?.queryData?.[0]?.dataSource,});logEventCalledRef.current = true;}@@ -372,7 +372,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {tableParams: {pagination: {offset: 0,- limit: updatedQuery.builder.queryData[0].limit || 0,+ limit: updatedQuery?.builder?.queryData?.[0]?.limit || 0,},},};@@ -601,7 +601,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {dashboardName: selectedDashboard?.data.title,queryType: currentQuery.queryType,isNewPanel: isUndefined(selectWidget),- dataSource: currentQuery.builder.queryData?.[0]?.dataSource,+ dataSource: currentQuery?.builder?.queryData?.[0]?.dataSource,});setSaveModal(true);// eslint-disable-next-line react-hooks/exhaustive-deps@@ -609,7 +609,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {const isNewTraceLogsAvailable =currentQuery.queryType === EQueryType.QUERY_BUILDER &&- currentQuery.builder.queryData.find(+ currentQuery?.builder?.queryData?.find((query) => query.dataSource !== DataSource.METRICS,) !== undefined;@@ -620,7 +620,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {}const isTraceOrLogsQueryBuilder =- currentQuery.builder.queryData.find(+ currentQuery?.builder?.queryData?.find((query) =>query.dataSource === DataSource.TRACES ||query.dataSource === DataSource.LOGS,@@ -632,7 +632,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {return isNewTraceLogsAvailable;}, [- currentQuery.builder.queryData,+ currentQuery?.builder?.queryData,selectedWidget?.id,isNewTraceLogsAvailable,]);@@ -661,7 +661,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {useEffect(() => {if (selectedGraph === PANEL_TYPES.LIST) {- const initialDataSource = currentQuery.builder.queryData[0].dataSource;+ const initialDataSource = currentQuery?.builder?.queryData?.[0]?.dataSource;if (initialDataSource === DataSource.LOGS) {// we do not need selected log columns in the request data as the entire response contains all the necessary datasetRequestData((prev) => ({diff --git a/frontend/src/container/PanelWrapper/HistogramPanelWrapper.tsx b/frontend/src/container/PanelWrapper/HistogramPanelWrapper.tsxindex 9f69a7eef9..fa557c575a 100644--- a/frontend/src/container/PanelWrapper/HistogramPanelWrapper.tsx+++ b/frontend/src/container/PanelWrapper/HistogramPanelWrapper.tsx@@ -55,7 +55,11 @@ function HistogramPanelWrapper({if (setGraphVisibility) {setGraphVisibility(localStoredVisibilityState);}- }, [queryResponse.data?.payload.data.result, setGraphVisibility, widget.id]);+ }, [+ queryResponse?.data?.payload?.data?.result,+ setGraphVisibility,+ widget.id,+ ]);const histogramOptions = useMemo(() =>diff --git a/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx b/frontend/src/container/PanelWrapper/PiePanelWrapper.tsxindex 237331dcda..454ea481e2 100644--- a/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx+++ b/frontend/src/container/PanelWrapper/PiePanelWrapper.tsx@@ -54,7 +54,7 @@ function PiePanelWrapper({const label = getLabelName(d.metric, d.queryName || '', d.legend || '');return {label,- value: d.values?.[0]?.[1],+ value: d?.values?.[0]?.[1],color:widget?.customLegendColors?.[label] ||generateColor(diff --git a/frontend/src/container/PanelWrapper/UplotPanelWrapper.tsx b/frontend/src/container/PanelWrapper/UplotPanelWrapper.tsxindex 1f50bc9eb1..4e99b5c33d 100644--- a/frontend/src/container/PanelWrapper/UplotPanelWrapper.tsx+++ b/frontend/src/container/PanelWrapper/UplotPanelWrapper.tsx@@ -75,7 +75,11 @@ function UplotPanelWrapper({if (setGraphVisibility) {setGraphVisibility(localStoredVisibilityState);}- }, [queryResponse.data?.payload.data.result, setGraphVisibility, widget.id]);+ }, [+ queryResponse?.data?.payload?.data?.result,+ setGraphVisibility,+ widget.id,+ ]);if (queryResponse.data && widget.panelTypes === PANEL_TYPES.BAR) {const sortedSeriesData = getSortedSeriesData(diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsxindex bdf2d16343..bbcdff7625 100644--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/SpanScopeSelector.tsx@@ -73,7 +73,7 @@ function SpanScopeSelector({ queryName }: SpanScopeSelectorProps): JSX.Element {};useEffect(() => {- const queryData = currentQuery.builder.queryData.find(+ const queryData = (currentQuery?.builder?.queryData || [])?.find((item) => item.queryName === queryName,);const filters = queryData?.filters?.items;diff --git a/frontend/src/container/Trace/Graph/config.ts b/frontend/src/container/Trace/Graph/config.tsindex ed0f383d9c..bb3f37a47b 100644--- a/frontend/src/container/Trace/Graph/config.ts+++ b/frontend/src/container/Trace/Graph/config.ts@@ -30,7 +30,7 @@ export const getChartData = (};const chartLabels: ChartData<'line'>['labels'] = [];- Object.keys(allDataPoints).forEach((timestamp) => {+ Object.keys(allDataPoints ?? {}).forEach((timestamp) => {const key = allDataPoints[timestamp];if (key.value) {chartDataset.data.push(key.value);diff --git a/frontend/src/hooks/queryBuilder/useGetQueryRange.ts b/frontend/src/hooks/queryBuilder/useGetQueryRange.tsindex b3941bc2de..2188f7a58a 100644--- a/frontend/src/hooks/queryBuilder/useGetQueryRange.ts+++ b/frontend/src/hooks/queryBuilder/useGetQueryRange.ts@@ -49,12 +49,12 @@ export const useGetQueryRange: UseGetQueryRange = (...requestData.query.builder,queryData: [{- ...requestData.query.builder.queryData[0],+ ...requestData?.query?.builder?.queryData[0],orderBy: [- ...requestData.query.builder.queryData[0].orderBy,+ ...(requestData?.query?.builder?.queryData[0]?.orderBy || []),{columnName: 'id',- order: requestData.query.builder.queryData[0].orderBy[0].order,+ order: requestData?.query?.builder?.queryData[0]?.orderBy[0]?.order,},],},diff --git a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts b/frontend/src/lib/uPlotLib/getUplotChartOptions.tsindex f9f8470328..fe9d88d9df 100644--- a/frontend/src/lib/uPlotLib/getUplotChartOptions.ts+++ b/frontend/src/lib/uPlotLib/getUplotChartOptions.ts@@ -432,18 +432,19 @@ export const getUPlotChartOptions = ({const globalCleanupHandler = (e: MouseEvent): void => {const target = e.target as HTMLElement;if (- !target.closest('.u-legend') &&- !target.classList.contains('legend-tooltip')+ target &&+ !target?.closest?.('.u-legend') &&+ !target?.classList?.contains?.('legend-tooltip')) {cleanupAllTooltips();}};- document.addEventListener('mousemove', globalCleanupHandler);+ document?.addEventListener('mousemove', globalCleanupHandler);// Store cleanup function for potential removal later(self as any)._tooltipCleanup = (): void => {cleanupAllTooltips();- document.removeEventListener('mousemove', globalCleanupHandler);+ document?.removeEventListener('mousemove', globalCleanupHandler);};const seriesEls = legend.querySelectorAll('.u-series');@@ -484,7 +485,7 @@ export const getUPlotChartOptions = ({const isTextTruncated = (): boolean => {// For right-side legends, check if text overflows the containerif (legendPosition === LegendPosition.RIGHT) {- return textSpan.scrollWidth > textSpan.clientWidth;+ return textSpan?.scrollWidth > textSpan?.clientWidth;}// For bottom legends, check if text is longer than reasonable display lengthreturn legendText.length > 20;@@ -526,9 +527,11 @@ export const getUPlotChartOptions = ({`;// Position tooltip near cursor- const rect = (e.target as HTMLElement).getBoundingClientRect();- tooltipElement.style.left = `${e.clientX + 10}px`;- tooltipElement.style.top = `${rect.top - 35}px`;+ const rect = (e.target as HTMLElement)?.getBoundingClientRect?.();+ if (rect) {+ tooltipElement.style.left = `${e.clientX + 10}px`;+ tooltipElement.style.top = `${rect.top - 35}px`;+ }document.body.appendChild(tooltipElement);}, 15);@@ -556,7 +559,7 @@ export const getUPlotChartOptions = ({// Helper function to handle stack chart logicconst handleStackChart = (): void => {- setHiddenGraph((prev) => {+ setHiddenGraph?.((prev) => {if (isUndefined(prev)) {return { [index]: true };}@@ -570,7 +573,7 @@ export const getUPlotChartOptions = ({// Marker click handler - checkbox behavior (toggle individual series)if (currentMarker) {currentMarker.addEventListener('click', (e) => {- e.stopPropagation(); // Prevent event bubbling to text handler+ e.stopPropagation?.(); // Prevent event bubbling to text handlerif (stackChart) {handleStackChart();@@ -583,7 +586,7 @@ export const getUPlotChartOptions = ({index + 1];- saveLegendEntriesToLocalStorage({+ saveLegendEntriesToLocalStorage?.({options: self,graphVisibilityState: newGraphVisibilityStates,name: id || '',@@ -597,7 +600,7 @@ export const getUPlotChartOptions = ({// Text click handler - show only/show all behavior (existing behavior)if (textElement) {textElement.addEventListener('click', (e) => {- e.stopPropagation(); // Prevent event bubbling+ e.stopPropagation?.(); // Prevent event bubblingif (stackChart) {handleStackChart();@@ -619,7 +622,7 @@ export const getUPlotChartOptions = ({newGraphVisibilityStates.fill(false);newGraphVisibilityStates[index + 1] = true;}- saveLegendEntriesToLocalStorage({+ saveLegendEntriesToLocalStorage?.({options: self,graphVisibilityState: newGraphVisibilityStates,name: id || '',diff --git a/frontend/src/lib/uPlotLib/utils/getUplotChartData.ts b/frontend/src/lib/uPlotLib/utils/getUplotChartData.tsindex 9a55248b50..a247559ef8 100644--- a/frontend/src/lib/uPlotLib/utils/getUplotChartData.ts+++ b/frontend/src/lib/uPlotLib/utils/getUplotChartData.ts@@ -31,7 +31,9 @@ function fillMissingXAxisTimestamps(timestampArr: number[], data: any[]): any {// Fill missing timestamps with null valuesprocessedData.forEach((entry: { values: (number | null)[][] }) => {- const existingTimestamps = new Set(entry.values.map((value) => value[0]));+ const existingTimestamps = new Set(+ (entry.values ?? []).map((value) => value[0]),+ );const missingTimestamps = Array.from(allTimestampsSet).filter((timestamp) => !existingTimestamps.has(timestamp),diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsxindex 745eabcc25..a51ac9439f 100644--- a/frontend/src/providers/Dashboard/Dashboard.tsx+++ b/frontend/src/providers/Dashboard/Dashboard.tsx@@ -291,7 +291,7 @@ export function DashboardProvider({},onSuccess: (data: SuccessResponseV2<Dashboard>) => {const updatedDashboardData = transformDashboardVariables(data?.data);- const updatedDate = dayjs(updatedDashboardData.updatedAt);+ const updatedDate = dayjs(updatedDashboardData?.updatedAt);setIsDashboardLocked(updatedDashboardData?.locked || false);@@ -303,7 +303,9 @@ export function DashboardProvider({dashboardRef.current = updatedDashboardData;- setLayouts(sortLayout(getUpdatedLayout(updatedDashboardData.data.layout)));+ setLayouts(+ sortLayout(getUpdatedLayout(updatedDashboardData?.data.layout)),+ );setPanelMap(defaultTo(updatedDashboardData?.data?.panelMap, {}));}@@ -312,7 +314,7 @@ export function DashboardProvider({updatedTimeRef.current !== null &&updatedDate.isAfter(updatedTimeRef.current) &&isVisible &&- dashboardRef.current?.id === updatedDashboardData.id+ dashboardRef.current?.id === updatedDashboardData?.id) {// show modal when state is out of syncconst modal = onModal.confirm({@@ -339,20 +341,20 @@ export function DashboardProvider({dashboardRef.current = updatedDashboardData;- updatedTimeRef.current = dayjs(updatedDashboardData.updatedAt);+ updatedTimeRef.current = dayjs(updatedDashboardData?.updatedAt);setLayouts(- sortLayout(getUpdatedLayout(updatedDashboardData.data.layout)),+ sortLayout(getUpdatedLayout(updatedDashboardData?.data.layout)),);- setPanelMap(defaultTo(updatedDashboardData.data.panelMap, {}));+ setPanelMap(defaultTo(updatedDashboardData?.data.panelMap, {}));},});modalRef.current = modal;} else {// normal flow- updatedTimeRef.current = dayjs(updatedDashboardData.updatedAt);+ updatedTimeRef.current = dayjs(updatedDashboardData?.updatedAt);dashboardRef.current = updatedDashboardData;@@ -363,14 +365,14 @@ export function DashboardProvider({if (!isEqual([omitBy(layouts, (value): boolean => isUndefined(value))[0]],- updatedDashboardData.data.layout,+ updatedDashboardData?.data.layout,)) {setLayouts(- sortLayout(getUpdatedLayout(updatedDashboardData.data.layout)),+ sortLayout(getUpdatedLayout(updatedDashboardData?.data.layout)),);- setPanelMap(defaultTo(updatedDashboardData.data.panelMap, {}));+ setPanelMap(defaultTo(updatedDashboardData?.data.panelMap, {}));}}},