diff --git a/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx b/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx index ebe90fdfb39b6e..450ee6d2aba22a 100644 --- a/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx @@ -213,7 +213,7 @@ const ActionsComponent: React.FC = ({ }, [activeStep, incrementStep, isTourAnchor, isTourShown, onEventDetailsPanelOpened]); const noteIds = useMemo( - () => (eventIdToNoteIds ? eventIdToNoteIds[eventId] || emptyNotes : emptyNotes), + () => eventIdToNoteIds?.[eventId] ?? emptyNotes, [eventIdToNoteIds, eventId] ); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_notes_in_flyout.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_notes_in_flyout.ts index 5ef26d8f5fe1f5..99a2dfe3953cec 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_notes_in_flyout.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_notes_in_flyout.ts @@ -45,7 +45,7 @@ export const useNotesInFlyout = (args: UseNotesInFlyoutArgs) => { const dispatch = useDispatch(); const noteIds: string[] = useMemo( - () => (eventIdToNoteIds && eventId && eventIdToNoteIds[eventId]) || EMPTY_STRING_ARRAY, + () => (eventId && eventIdToNoteIds?.[eventId]) || EMPTY_STRING_ARRAY, [eventIdToNoteIds, eventId] ); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/index.tsx index c0d3bf907d7770..d41ba9dfcc5d7b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/unified_components/data_table/index.tsx @@ -400,6 +400,14 @@ export const TimelineDataTableComponent: React.FC = memo( }; }, [expandedDoc]); + const finalRenderCustomBodyCallback = useMemo(() => { + return enabledRowRenderers.length > 0 ? renderCustomBodyCallback : undefined; + }, [enabledRowRenderers.length, renderCustomBodyCallback]); + + const finalTrailControlColumns = useMemo(() => { + return enabledRowRenderers.length > 0 ? trailingControlColumns : undefined; + }, [enabledRowRenderers.length, trailingControlColumns]); + return ( @@ -449,12 +457,8 @@ export const TimelineDataTableComponent: React.FC = memo( showMultiFields={true} cellActionsMetadata={cellActionsMetadata} externalAdditionalControls={additionalControls} - renderCustomGridBody={ - enabledRowRenderers.length > 0 ? renderCustomBodyCallback : undefined - } - trailingControlColumns={ - enabledRowRenderers.length > 0 ? trailingControlColumns : undefined - } + renderCustomGridBody={finalRenderCustomBodyCallback} + trailingControlColumns={finalTrailControlColumns} externalControlColumns={leadingControlColumns} cellContext={cellContext} />