From 0fbf560981d199bf7eea4db568644ab3d49f5d92 Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Mon, 6 Apr 2020 19:35:43 -0500 Subject: [PATCH] Don't fetch service map data if no license (#62071) (#62717) 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 63bc1b9b8f557..3dae4dc4e5ecb 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 @@ -32,7 +32,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();