From 7e35858547b1b27d0b028669202ddbb64e0e11f0 Mon Sep 17 00:00:00 2001 From: FrankHassanabad Date: Thu, 14 Oct 2021 20:49:21 -0600 Subject: [PATCH] one line remove assert --- .../pages/detection_engine/rules/details/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx index 7167b07c7da5d..774b9463bed69 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx @@ -300,10 +300,8 @@ const RuleDetailsPageComponent: React.FC = ({ }, [rule, spacesApi]); const getLegacyUrlConflictCallout = useMemo(() => { - const outcome = rule?.outcome; - if (rule != null && spacesApi && outcome === 'conflict') { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const aliasTargetId = rule?.alias_target_id!; // This is always defined if outcome === 'conflict' + if (rule?.alias_target_id != null && spacesApi && rule.outcome === 'conflict') { + const aliasTargetId = rule.alias_target_id; // We have resolved to one rule, but there is another one with a legacy URL associated with this page. Display a // callout with a warning for the user, and provide a way for them to navigate to the other rule. const otherRulePath = `rules/id/${aliasTargetId}${window.location.search}${window.location.hash}`;