Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solutions] Removes one line non-null-assert using optional chaining and type narrowing #115127

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,8 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
}, [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}`;
Expand Down