Skip to content

Commit

Permalink
[APM] service maps: avoid unnecesary useDeepObjectIdentity (#60836) (
Browse files Browse the repository at this point in the history
…#60861)

* [APM] service maps: avoid unnecesary `useDeepObjectIdentity`

* Remove unused dep
  • Loading branch information
sorenlouv authored Mar 21, 2020
1 parent 83ebc1e commit 095cdc8
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) : [];
Expand Down

0 comments on commit 095cdc8

Please sign in to comment.