From 7291c3949709c1489590465b6473059f7fa3002c Mon Sep 17 00:00:00 2001 From: Melissa Date: Mon, 1 Apr 2024 11:17:54 -0600 Subject: [PATCH] ensure selectedDetectorIndex is passed to chart correctly --- .../embeddable_single_metric_viewer_container.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/ml/public/embeddables/single_metric_viewer/embeddable_single_metric_viewer_container.tsx b/x-pack/plugins/ml/public/embeddables/single_metric_viewer/embeddable_single_metric_viewer_container.tsx index 2de64053dcdf1..3aa0e332dcaf5 100644 --- a/x-pack/plugins/ml/public/embeddables/single_metric_viewer/embeddable_single_metric_viewer_container.tsx +++ b/x-pack/plugins/ml/public/embeddables/single_metric_viewer/embeddable_single_metric_viewer_container.tsx @@ -60,7 +60,6 @@ export const EmbeddableSingleMetricViewerContainer: FC< const [chartWidth, setChartWidth] = useState(0); const [zoom, setZoom] = useState(); const [selectedForecastId, setSelectedForecastId] = useState(); - const [detectorIndex, setDetectorIndex] = useState(0); const [selectedJob, setSelectedJob] = useState(); const [autoZoomDuration, setAutoZoomDuration] = useState(); const [jobsLoaded, setJobsLoaded] = useState(false); @@ -140,10 +139,6 @@ export const EmbeddableSingleMetricViewerContainer: FC< */ switch (action) { - case APP_STATE_ACTION.SET_DETECTOR_INDEX: - setDetectorIndex(payload); - break; - case APP_STATE_ACTION.SET_FORECAST_ID: setSelectedForecastId(payload); setZoom(undefined); @@ -159,7 +154,7 @@ export const EmbeddableSingleMetricViewerContainer: FC< } }, - [setZoom, setDetectorIndex, setSelectedForecastId] + [setZoom, setSelectedForecastId] ); const containerPadding = 10; @@ -191,7 +186,7 @@ export const EmbeddableSingleMetricViewerContainer: FC< lastRefresh={lastRefresh ?? 0} previousRefresh={previousRefresh} selectedJobId={selectedJobId} - selectedDetectorIndex={detectorIndex} + selectedDetectorIndex={data.selectedDetectorIndex} selectedEntities={data.selectedEntities} selectedForecastId={selectedForecastId} tableInterval="auto"