From adf12d0e90f44cad2ad5d145d10e92f7c6b4620e Mon Sep 17 00:00:00 2001 From: Andreas Christou Date: Tue, 18 Apr 2023 16:45:59 +0100 Subject: [PATCH] CloudMonitor: Correctly re-render `VisualMetricQueryEditor` on `TimeRange` updates (#66756) Compare string value rather than object --- .../cloud-monitoring/components/VisualMetricQueryEditor.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx index be1fe2a1b03..5e9976b3526 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx @@ -48,7 +48,11 @@ export function Editor({ const [timeRange, setTimeRange] = useState({ ...datasource.timeSrv.timeRange() }); const useTime = (time: TimeRange) => { - if (timeRange !== null && (timeRange.raw.from !== time.raw.from || timeRange.raw.to !== time.raw.to)) { + if ( + timeRange !== null && + (timeRange.raw.from.toString() !== time.raw.from.toString() || + timeRange.raw.to.toString() !== time.raw.to.toString()) + ) { setTimeRange({ ...time }); } };