Skip to content

Commit

Permalink
Reverts PR 124310 (elastic#124736)
Browse files Browse the repository at this point in the history
## Summary

Reverts elastic#124310 through the commands:

```sh
git revert 30f2ce4 --no-commit
git revert de32a55 --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 ea6347c)
  • Loading branch information
FrankHassanabad authored and kqualters-elastic committed Feb 8, 2022
1 parent 897fe89 commit e3f3b58
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface InvestigateInTimelineActionProps {
alertIds?: string[];
buttonType?: 'text' | 'icon';
onInvestigateInTimelineAlertClick?: () => void;
timelineId?: string;
}

const InvestigateInTimelineActionComponent: React.FC<InvestigateInTimelineActionProps> = ({
Expand All @@ -31,13 +30,11 @@ const InvestigateInTimelineActionComponent: React.FC<InvestigateInTimelineAction
ecsRowData,
buttonType,
onInvestigateInTimelineAlertClick,
timelineId,
}) => {
const { investigateInTimelineAlertClick } = useInvestigateInTimeline({
ecsRowData,
alertIds,
onInvestigateInTimelineAlertClick,
timelineId,
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -25,11 +25,10 @@ export const useFetchEcsAlertsData = ({
}): { isLoading: boolean | null; alertsEcsData: Ecs[] | null } => {
const [isLoading, setIsLoading] = useState<boolean | null>(null);
const [alertsEcsData, setAlertEcsData] = useState<Ecs[] | null>(null);
const abortCtrl = useRef(new AbortController());

useEffect(() => {
let isSubscribed = true;
const controller = abortCtrl.current;
const abortCtrl = new AbortController();

const fetchAlert = async () => {
try {
Expand Down Expand Up @@ -73,7 +72,7 @@ export const useFetchEcsAlertsData = ({

return (): void => {
isSubscribed = false;
controller.abort();
abortCtrl.abort();
};
}, [alertIds, onError, skip]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ const ActionsComponent: React.FC<ActionProps> = ({
key="investigate-in-timeline"
alertIds={alertIds}
ecsRowData={ecsData}
timelineId={timelineId}
/>
)}

Expand Down

0 comments on commit e3f3b58

Please sign in to comment.