From c5d98ffdaf1c273df0467f96666e10656d138a5f Mon Sep 17 00:00:00 2001 From: Kevin Lacabane Date: Wed, 6 Oct 2021 13:30:27 +0200 Subject: [PATCH] update setup mode data when required (#113934) --- .../public/application/pages/page_template.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/monitoring/public/application/pages/page_template.tsx b/x-pack/plugins/monitoring/public/application/pages/page_template.tsx index 7c6a6c56a13226..927c4645520877 100644 --- a/x-pack/plugins/monitoring/public/application/pages/page_template.tsx +++ b/x-pack/plugins/monitoring/public/application/pages/page_template.tsx @@ -12,7 +12,11 @@ import { useTitle } from '../hooks/use_title'; import { MonitoringToolbar } from '../../components/shared/toolbar'; import { MonitoringTimeContainer } from '../hooks/use_monitoring_time'; import { PageLoading } from '../../components'; -import { getSetupModeState, isSetupModeFeatureEnabled } from '../setup_mode/setup_mode'; +import { + getSetupModeState, + isSetupModeFeatureEnabled, + updateSetupModeData, +} from '../setup_mode/setup_mode'; import { SetupModeFeature } from '../../../common/enums'; export interface TabMenuItem { @@ -54,7 +58,12 @@ export const PageTemplate: React.FC = ({ }, [getPageData, currentTimerange]); const onRefresh = () => { - getPageData?.().catch((err) => { + const requests = [getPageData?.()]; + if (isSetupModeFeatureEnabled(SetupModeFeature.MetricbeatMigration)) { + requests.push(updateSetupModeData()); + } + + Promise.allSettled(requests).then((results) => { // TODO: handle errors }); };