From 095cdc8ec1971723d6c3c9feb55a305f8362e752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Louv-Jansen?= Date: Sat, 21 Mar 2020 23:58:17 +0100 Subject: [PATCH] [APM] service maps: avoid unnecesary `useDeepObjectIdentity` (#60836) (#60861) * [APM] service maps: avoid unnecesary `useDeepObjectIdentity` * Remove unused dep --- .../components/app/ServiceMap/index.tsx | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 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 6222a00a9e888..5caa37e5fae4b 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 @@ -10,7 +10,6 @@ import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; import styled from 'styled-components'; import { isValidPlatinumLicense } from '../../../../../../../plugins/apm/common/service_map'; -import { useDeepObjectIdentity } from '../../../hooks/useDeepObjectIdentity'; import { useFetcher } from '../../../hooks/useFetcher'; import { useLicense } from '../../../hooks/useLicense'; import { useLocation } from '../../../hooks/useLocation'; @@ -58,33 +57,27 @@ export function ServiceMap({ serviceName }: ServiceMapProps) { const license = useLicense(); const { search } = useLocation(); const { urlParams, uiFilters } = useUrlParams(); - const params = useDeepObjectIdentity({ - start: urlParams.start, - end: urlParams.end, - environment: urlParams.environment, - serviceName, - uiFilters: { - ...uiFilters, - environment: undefined - } - }); const { data } = useFetcher(() => { - const { start, end } = params; + const { start, end, environment } = urlParams; if (start && end) { return callApmApi({ pathname: '/api/apm/service-map', params: { query: { - ...params, start, end, - uiFilters: JSON.stringify(params.uiFilters) + environment, + serviceName, + uiFilters: JSON.stringify({ + ...uiFilters, + environment: undefined + }) } } }); } - }, [params]); + }, [serviceName, uiFilters, urlParams]); const elements = useMemo(() => { return data ? getCytoscapeElements(data as any, search) : [];