From 4e2516d12ab3fdf13c46b7acaed2e79efa6ca044 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Fri, 27 Aug 2021 12:40:33 -0500 Subject: [PATCH] GraphNG: fix crash when trying to diff missing timeRange prop (#38654) --- packages/grafana-ui/src/components/uPlot/Plot.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/uPlot/Plot.tsx b/packages/grafana-ui/src/components/uPlot/Plot.tsx index 5ae2fa1f638..49d13b7f61f 100755 --- a/packages/grafana-ui/src/components/uPlot/Plot.tsx +++ b/packages/grafana-ui/src/components/uPlot/Plot.tsx @@ -19,7 +19,11 @@ function sameConfig(prevProps: PlotProps, nextProps: PlotProps) { function sameTimeRange(prevProps: PlotProps, nextProps: PlotProps) { let prevTime = prevProps.timeRange; let nextTime = nextProps.timeRange; - return nextTime.from.valueOf() === prevTime.from.valueOf() && nextTime.to.valueOf() === prevTime.to.valueOf(); + + return ( + prevTime === nextTime || + (nextTime.from.valueOf() === prevTime.from.valueOf() && nextTime.to.valueOf() === prevTime.to.valueOf()) + ); } type UPlotChartState = {