From 52a4967123598ac7b9c71084bcf7f1096c5aaaa3 Mon Sep 17 00:00:00 2001 From: iblancof Date: Fri, 18 Oct 2024 10:09:15 +0200 Subject: [PATCH] Add missing onboardingFlow dep when fetching hasData --- .../shared/templates/infra_page_template.tsx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx b/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx index 7446732b959a8..b7318c736843a 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx @@ -41,15 +41,18 @@ export const InfraPageTemplate = ({ const { error: dataViewLoadError, refetch: loadDataView } = useMetricsDataViewContext(); const { remoteClustersExist } = source?.status ?? {}; - const { data, status } = useFetcher(async (callApi) => { - if (!onboardingFlow) return; - return await callApi('/api/metrics/source/hasData', { - method: 'GET', - query: { - modules: dataAvailabilityModules, - }, - }); - }); + const { data, status } = useFetcher( + async (callApi) => { + if (!onboardingFlow) return; + return await callApi('/api/metrics/source/hasData', { + method: 'GET', + query: { + modules: dataAvailabilityModules, + }, + }); + }, + [onboardingFlow, dataAvailabilityModules] + ); const hasData = !!data?.hasData; const noDataConfig = getNoDataConfig({