Skip to content

Commit

Permalink
types
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Sep 2, 2020
1 parent eee296f commit 0519866
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand All @@ -78,7 +78,6 @@ export const useNetworkTopCountries = ({
factoryQueryType: NetworkQueries.topCountries,
filterQuery: createFilter(filterQuery),
flowTarget,
// inspect: isInspected,
pagination: generateTablePaginationOptions(activePage, limit),
sort,
timerange: {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -176,10 +175,6 @@ export const useNetworkTopCountries = ({
);

useEffect(() => {
if (skip) {
return;
}

setHostRequest((prevRequest) => {
const myRequest = {
...prevRequest,
Expand All @@ -193,7 +188,7 @@ export const useNetworkTopCountries = ({
to: endDate,
},
};
if (!deepEqual(prevRequest, myRequest)) {
if (!skip && !deepEqual(prevRequest, myRequest)) {
return myRequest;
}
return prevRequest;
Expand Down

0 comments on commit 0519866

Please sign in to comment.