diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js
index a6ec139ab94ba..9dafb2cb75bb1 100644
--- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js
+++ b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js
@@ -103,6 +103,7 @@ const TimeseriesChartIntl = injectI18n(class TimeseriesChart extends React.Compo
focusAnnotationData: PropTypes.array,
focusChartData: PropTypes.array,
focusForecastData: PropTypes.array,
+ loading: PropTypes.bool.isRequired,
modelPlotEnabled: PropTypes.bool.isRequired,
renderFocusChartOnly: PropTypes.bool.isRequired,
selectedJob: PropTypes.object,
@@ -202,6 +203,10 @@ const TimeseriesChartIntl = injectI18n(class TimeseriesChart extends React.Compo
}
componentDidUpdate() {
+ if (this.props.loading) {
+ return;
+ }
+
if (this.props.renderFocusChartOnly === false) {
this.renderChart();
this.drawContextChartSelection();
@@ -1063,6 +1068,15 @@ const TimeseriesChartIntl = injectI18n(class TimeseriesChart extends React.Compo
const selectionMin = selectedBounds[0].getTime();
const selectionMax = selectedBounds[1].getTime();
+ // Avoid triggering an update if bounds haven't changed
+ if (
+ that.selectedBounds !== undefined &&
+ that.selectedBounds.min.valueOf() === selectionMin &&
+ that.selectedBounds.max.valueOf() === selectionMax
+ ) {
+ return;
+ }
+
// Set the color of the swimlane cells according to whether they are inside the selection.
contextGroup.selectAll('.swimlane-cell')
.style('fill', (d) => {
diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js
index ca15be6cad167..e9876b518f844 100644
--- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js
+++ b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js
@@ -136,7 +136,7 @@ const TimeSeriesExplorerPage = ({ children, jobSelectorProps, loading, resizeRef
{loading && (