From 051986653b386bfeb341378aff8dab10c4833c37 Mon Sep 17 00:00:00 2001 From: Patryk Kopycinski Date: Wed, 2 Sep 2020 17:04:47 +0200 Subject: [PATCH] types --- .../containers/network_top_countries/index.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx b/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx index 7fd4294419760..2e479face9530 100644 --- a/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx @@ -25,13 +25,15 @@ import { NetworkTopCountriesStrategyResponse, } from '../../../../common/search_strategy/security_solution/network'; import { AbortError } from '../../../../../../../src/plugins/data/common'; +import { getInspectResponse } from '../../../helpers'; +import { InspectResponse } from '../../../types'; import * as i18n from './translations'; const ID = 'networkTopCountriesQuery'; export interface NetworkTopCountriesArgs { id: string; - inspect: inputsModel.InspectQuery; + inspect: InspectResponse; isInspected: boolean; loadPage: (newActivePage: number) => void; pageInfo: PageInfoPaginated; @@ -60,8 +62,6 @@ export const useNetworkTopCountries = ({ startDate, type, }: UseNetworkTopCountries): [boolean, NetworkTopCountriesArgs] => { - // const getQuery = inputsSelectors.globalQueryByIdSelector(); - // const { isInspected } = useSelector((state: State) => getQuery(state, id), shallowEqual); const getTopCountriesSelector = networkSelectors.topCountriesSelector(); const { activePage, limit, sort } = useSelector( (state: State) => getTopCountriesSelector(state, type, flowTarget), @@ -78,7 +78,6 @@ export const useNetworkTopCountries = ({ factoryQueryType: NetworkQueries.topCountries, filterQuery: createFilter(filterQuery), flowTarget, - // inspect: isInspected, pagination: generateTablePaginationOptions(activePage, limit), sort, timerange: { @@ -138,7 +137,7 @@ export const useNetworkTopCountries = ({ setNetworkTopCountriesResponse((prevResponse) => ({ ...prevResponse, networkTopCountries: response.edges, - inspect: response.inspect ?? prevResponse.inspect, + inspect: getInspectResponse(response, prevResponse.inspect), pageInfo: response.pageInfo, refetch: refetch.current, totalCount: response.totalCount, @@ -176,10 +175,6 @@ export const useNetworkTopCountries = ({ ); useEffect(() => { - if (skip) { - return; - } - setHostRequest((prevRequest) => { const myRequest = { ...prevRequest, @@ -193,7 +188,7 @@ export const useNetworkTopCountries = ({ to: endDate, }, }; - if (!deepEqual(prevRequest, myRequest)) { + if (!skip && !deepEqual(prevRequest, myRequest)) { return myRequest; } return prevRequest;