diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/index.tsx index 674d29b12841..97f02b8e35cf 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/index.tsx @@ -233,6 +233,7 @@ const RuleDetailsPageComponent: React.FC = ({ detailName: string; tabName: string; }>(); + const { rule: maybeRule, refresh: refreshRule, @@ -382,19 +383,21 @@ const RuleDetailsPageComponent: React.FC = ({ [clearEventsLoading, clearEventsDeleted, clearSelected, setFilterGroup] ); + const isBuildingBlockTypeNotNull = rule?.building_block_type != null; // Set showBuildingBlockAlerts if rule is a Building Block Rule otherwise we won't show alerts useEffect(() => { - setShowBuildingBlockAlerts(rule?.building_block_type != null); - }, [rule, setShowBuildingBlockAlerts]); + setShowBuildingBlockAlerts(isBuildingBlockTypeNotNull); + }, [isBuildingBlockTypeNotNull, setShowBuildingBlockAlerts]); + const ruleRuleId = rule?.rule_id ?? ''; const alertDefaultFilters = useMemo( () => [ - ...buildAlertsFilter(rule?.rule_id ?? ''), + ...buildAlertsFilter(ruleRuleId ?? ''), ...buildShowBuildingBlockFilter(showBuildingBlockAlerts), ...buildAlertStatusFilter(filterGroup), ...buildThreatMatchFilter(showOnlyThreatIndicatorAlerts), ], - [rule, showBuildingBlockAlerts, showOnlyThreatIndicatorAlerts, filterGroup] + [ruleRuleId, showBuildingBlockAlerts, showOnlyThreatIndicatorAlerts, filterGroup] ); const alertMergedFilters = useMemo(