Skip to content

Commit 987899a

Browse files
fix skip
1 parent 5a5ad42 commit 987899a

3 files changed

Lines changed: 9 additions & 16 deletions

File tree

x-pack/plugins/security_solution/public/hosts/containers/hosts/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ interface UseAllHost {
4747
docValueFields?: DocValueFields[];
4848
filterQuery?: ESTermQuery | string;
4949
endDate: string;
50+
skip?: boolean;
5051
startDate: string;
5152
type: hostsModel.HostsType;
5253
}
@@ -55,6 +56,7 @@ export const useAllHost = ({
5556
docValueFields,
5657
filterQuery,
5758
endDate,
59+
skip = false,
5860
startDate,
5961
type,
6062
}: UseAllHost): [boolean, HostsArgs] => {
@@ -189,7 +191,7 @@ export const useAllHost = ({
189191
field: sortField,
190192
},
191193
};
192-
if (!deepEqual(prevRequest, myRequest)) {
194+
if (!skip && !deepEqual(prevRequest, myRequest)) {
193195
return myRequest;
194196
}
195197
return prevRequest;
@@ -202,6 +204,7 @@ export const useAllHost = ({
202204
endDate,
203205
filterQuery,
204206
limit,
207+
skip,
205208
startDate,
206209
sortField,
207210
]);

x-pack/plugins/security_solution/public/hosts/containers/hosts/overview/_index.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import deepEqual from 'fast-deep-equal';
1010
import { noop } from 'lodash/fp';
1111
import { useCallback, useEffect, useRef, useState } from 'react';
12-
import { useSelector, shallowEqual } from 'react-redux';
1312

1413
import { DEFAULT_INDEX_KEY } from '../../../../../common/constants';
15-
import { inputsModel, inputsSelectors, State } from '../../../../common/store';
14+
import { inputsModel } from '../../../../common/store';
1615
import { useKibana } from '../../../../common/lib/kibana';
1716
import {
1817
HostItem,
@@ -46,13 +45,10 @@ interface UseHostOverview {
4645
export const useHostOverview = ({
4746
endDate,
4847
hostName,
49-
skip,
48+
skip = false,
5049
startDate,
5150
id = ID,
5251
}: UseHostOverview): [boolean, HostOverviewArgs] => {
53-
const getQuery = inputsSelectors.globalQueryByIdSelector();
54-
// @ts-expect-error
55-
const { isInspected } = useSelector((state: State) => getQuery(state, id), shallowEqual);
5652
const { data, notifications, uiSettings } = useKibana().services;
5753
const refetch = useRef<inputsModel.Refetch>(noop);
5854
const abortCtrl = useRef(new AbortController());
@@ -62,13 +58,11 @@ export const useHostOverview = ({
6258
defaultIndex,
6359
hostName,
6460
factoryQueryType: HostsQueries.hostOverview,
65-
skip,
6661
timerange: {
6762
interval: '12h',
6863
from: startDate,
6964
to: endDate,
7065
},
71-
// isInspected,
7266
});
7367

7468
const [hostOverviewResponse, setHostOverviewResponse] = useState<HostOverviewArgs>({
@@ -85,10 +79,6 @@ export const useHostOverview = ({
8579

8680
const hostOverviewSearch = useCallback(
8781
(request: HostOverviewRequestOptions) => {
88-
if (request.skip) {
89-
return;
90-
}
91-
9282
let didCancel = false;
9383
const asyncSearch = async () => {
9484
abortCtrl.current = new AbortController();
@@ -148,14 +138,13 @@ export const useHostOverview = ({
148138
...prevRequest,
149139
defaultIndex,
150140
hostName,
151-
skip,
152141
timerange: {
153142
interval: '12h',
154143
from: startDate,
155144
to: endDate,
156145
},
157146
};
158-
if (!deepEqual(prevRequest, myRequest)) {
147+
if (!skip && !deepEqual(prevRequest, myRequest)) {
159148
return myRequest;
160149
}
161150
return prevRequest;

x-pack/plugins/security_solution/public/hosts/pages/navigation/hosts_query_tab_body.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export const HostsQueryTabBody = ({
2727
const [
2828
loading,
2929
{ hosts, totalCount, pageInfo, loadPage, id, inspect, isInspected, refetch },
30-
] = useAllHost({ docValueFields, endDate, filterQuery, startDate, type });
30+
] = useAllHost({ docValueFields, endDate, filterQuery, skip, startDate, type });
31+
3132
return (
3233
<HostsTableManage
3334
deleteQuery={deleteQuery}

0 commit comments

Comments
 (0)