CloudMonitor: Correctly re-render `VisualMetricQueryEditor` on `TimeRange` updates (#66756)

Compare string value rather than object
pull/66049/head^2
Andreas Christou 2 years ago committed by GitHub
parent c0799345dd
commit adf12d0e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx

@ -48,7 +48,11 @@ export function Editor({
const [timeRange, setTimeRange] = useState<TimeRange>({ ...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 });
}
};

Loading…
Cancel
Save