From 688ec93c073a6dd12b9ce56d822ae633fce5e8f2 Mon Sep 17 00:00:00 2001 From: Michael Olorunnisola Date: Mon, 15 Apr 2024 09:23:48 -0400 Subject: [PATCH] memoize fn call --- .../data_table/use_event_type_row_styling.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/use_event_type_row_styling.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/use_event_type_row_styling.tsx index 805e286c3a16451..757d3d180929472 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/use_event_type_row_styling.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/use_event_type_row_styling.tsx @@ -3,7 +3,7 @@ import { useMemo } from "react"; import { getEventType, isEvenEqlSequence, isEventBuildingBlockType } from "../../body/helpers"; export const useEventTypeRowStyling = (ecsData: TimelineItem['ecs']) => { - const eventType = getEventType(ecsData); + const eventType = useMemo(() => getEventType(ecsData), []); const eventTypeClassName = useMemo( () => eventType === 'raw' @@ -20,5 +20,5 @@ export const useEventTypeRowStyling = (ecsData: TimelineItem['ecs']) => { [ecsData] ); - return useMemo(() => [eventTypeClassName, buildingBlockTypeClassName].join(' '), []); + return useMemo(() => `${eventTypeClassName} ${buildingBlockTypeClassName}`, []); } \ No newline at end of file