mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Security Solution][Notes] - fix infinite look refresh note with investigation query (#189606)
This commit is contained in:
parent
e828f7508d
commit
9e4b353897
2 changed files with 12 additions and 7 deletions
|
@ -18,6 +18,9 @@ import { useSourcererDataView } from '../../../../../sourcerer/containers';
|
|||
import { SourcererScopeName } from '../../../../../sourcerer/store/model';
|
||||
import type { TimeRange } from '../../../../store/inputs/model';
|
||||
|
||||
const fields = ['*'];
|
||||
const runtimeMappings = {};
|
||||
|
||||
export interface UseInsightQuery {
|
||||
dataProviders: DataProvider[];
|
||||
filters: Filter[];
|
||||
|
@ -67,16 +70,16 @@ export const useInsightQuery = ({
|
|||
|
||||
const [dataLoadingState, { events, totalCount }] = useTimelineEvents({
|
||||
dataViewId,
|
||||
fields: ['*'],
|
||||
fields,
|
||||
filterQuery: combinedQueries?.filterQuery,
|
||||
id: TimelineId.active,
|
||||
indexNames: selectedPatterns,
|
||||
language: 'kuery',
|
||||
limit: 1,
|
||||
runtimeMappings: {},
|
||||
...(relativeTimerange
|
||||
? { startDate: relativeTimerange?.from, endDate: relativeTimerange?.to }
|
||||
: {}),
|
||||
runtimeMappings,
|
||||
startDate: relativeTimerange?.from,
|
||||
endDate: relativeTimerange?.to,
|
||||
fetchNotes: false,
|
||||
});
|
||||
|
||||
const isQueryLoading = useMemo(
|
||||
|
|
|
@ -96,6 +96,7 @@ export interface UseTimelineEventsProps {
|
|||
sort?: TimelineRequestSortField[];
|
||||
startDate?: string;
|
||||
timerangeKind?: 'absolute' | 'relative';
|
||||
fetchNotes?: boolean;
|
||||
}
|
||||
|
||||
const getTimelineEvents = (timelineEdges: TimelineEdges[]): TimelineItem[] =>
|
||||
|
@ -482,6 +483,7 @@ export const useTimelineEvents = ({
|
|||
sort = initSortDefault,
|
||||
skip = false,
|
||||
timerangeKind,
|
||||
fetchNotes = true,
|
||||
}: UseTimelineEventsProps): [DataLoadingState, TimelineArgs] => {
|
||||
const [dataLoadingState, timelineResponse, timelineSearchHandler] = useTimelineEventsHandler({
|
||||
dataViewId,
|
||||
|
@ -503,9 +505,9 @@ export const useTimelineEvents = ({
|
|||
|
||||
const onTimelineSearchComplete: OnNextResponseHandler = useCallback(
|
||||
(response) => {
|
||||
onLoad(response.events);
|
||||
if (fetchNotes) onLoad(response.events);
|
||||
},
|
||||
[onLoad]
|
||||
[fetchNotes, onLoad]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue