From e3f3b585da91ca8684e28204a38d323ed32d03b1 Mon Sep 17 00:00:00 2001 From: Frank Hassanabad Date: Fri, 4 Feb 2022 19:05:50 -0700 Subject: [PATCH] Reverts PR 124310 (#124736) ## Summary Reverts https://github.com/elastic/kibana/pull/124310 through the commands: ```sh git revert 30f2ce42f0f9a4c4ae902ca2ababbf7d56a8fadf --no-commit git revert de32a55bcf479bf42122aa78467fedb450d15c78 --no-commit git checkout -b 'revert-124310' git add . git push ``` Double check that this does look like a revert of that PR. This is for `main` only. (cherry picked from commit ea6347cb9976fded63b429ce55e5581f3a039dc8) --- .../timeline_actions/investigate_in_timeline_action.tsx | 3 --- .../timeline_actions/use_investigate_in_timeline.tsx | 4 +--- .../detection_engine/alerts/use_fetch_ecs_alerts_data.ts | 7 +++---- .../timelines/components/timeline/body/actions/index.tsx | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx index 01d280d61d720..bca04dcf37a5b 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx @@ -22,7 +22,6 @@ interface InvestigateInTimelineActionProps { alertIds?: string[]; buttonType?: 'text' | 'icon'; onInvestigateInTimelineAlertClick?: () => void; - timelineId?: string; } const InvestigateInTimelineActionComponent: React.FC = ({ @@ -31,13 +30,11 @@ const InvestigateInTimelineActionComponent: React.FC { const { investigateInTimelineAlertClick } = useInvestigateInTimeline({ ecsRowData, alertIds, onInvestigateInTimelineAlertClick, - timelineId, }); return ( diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx index 54e7da3066ea1..c1cbe657415a6 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx @@ -27,14 +27,12 @@ interface UseInvestigateInTimelineActionProps { nonEcsRowData?: TimelineNonEcsData[]; alertIds?: string[] | null | undefined; onInvestigateInTimelineAlertClick?: () => void; - timelineId?: string; } export const useInvestigateInTimeline = ({ ecsRowData, alertIds, onInvestigateInTimelineAlertClick, - timelineId, }: UseInvestigateInTimelineActionProps) => { const { data: { search: searchStrategyClient, query }, @@ -80,7 +78,7 @@ export const useInvestigateInTimeline = ({ const showInvestigateInTimelineAction = alertIds != null; const { isLoading: isFetchingAlertEcs, alertsEcsData } = useFetchEcsAlertsData({ alertIds, - skip: alertIds == null || timelineId !== undefined, + skip: alertIds == null, }); const investigateInTimelineAlertClick = useCallback(async () => { diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts index f7c3c341bfa29..c459fab89a25e 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_fetch_ecs_alerts_data.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { useEffect, useState, useRef } from 'react'; +import { useEffect, useState } from 'react'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { isEmpty } from 'lodash'; @@ -25,11 +25,10 @@ export const useFetchEcsAlertsData = ({ }): { isLoading: boolean | null; alertsEcsData: Ecs[] | null } => { const [isLoading, setIsLoading] = useState(null); const [alertsEcsData, setAlertEcsData] = useState(null); - const abortCtrl = useRef(new AbortController()); useEffect(() => { let isSubscribed = true; - const controller = abortCtrl.current; + const abortCtrl = new AbortController(); const fetchAlert = async () => { try { @@ -73,7 +72,7 @@ export const useFetchEcsAlertsData = ({ return (): void => { isSubscribed = false; - controller.abort(); + abortCtrl.abort(); }; }, [alertIds, onError, skip]); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx index 53764bd8d2539..75ca399bf52d4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx @@ -169,7 +169,6 @@ const ActionsComponent: React.FC = ({ key="investigate-in-timeline" alertIds={alertIds} ecsRowData={ecsData} - timelineId={timelineId} /> )}