From bc757bc9a1ee01ef8f58fb02f65d3394f9e8427e Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Tue, 31 Mar 2020 15:32:56 -0500 Subject: [PATCH] Don't fetch service map data if no license Fixes #61994 --- .../apm/public/components/app/ServiceMap/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx index 0abaa9d76fc07..351e039ca45df 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/index.tsx @@ -33,7 +33,12 @@ export function ServiceMap({ serviceName }: ServiceMapProps) { const license = useLicense(); const { urlParams } = useUrlParams(); - const { data } = useFetcher(() => { + const { data = { elements: [] } } = useFetcher(() => { + // When we don't have a license or a valid license, don't make the request. + if (!license || !isValidPlatinumLicense(license)) { + return; + } + const { start, end, environment } = urlParams; if (start && end) { return callApmApi({ @@ -48,7 +53,7 @@ export function ServiceMap({ serviceName }: ServiceMapProps) { } }); } - }, [serviceName, urlParams]); + }, [license, serviceName, urlParams]); const { ref, height, width } = useRefDimensions();