diff --git a/public/app/features/alerting/unified/RuleViewer.tsx b/public/app/features/alerting/unified/RuleViewer.tsx index 647795709f7..0ab15ba383a 100644 --- a/public/app/features/alerting/unified/RuleViewer.tsx +++ b/public/app/features/alerting/unified/RuleViewer.tsx @@ -45,9 +45,10 @@ const pageTitle = 'Alerting / View rule'; export function RuleViewer({ match }: RuleViewerProps) { const styles = useStyles2(getStyles); - const { id, sourceName } = match.params; + const { id } = match.params; const identifier = ruleId.tryParse(id, true); - const { loading, error, result: rule } = useCombinedRule(identifier, sourceName); + + const { loading, error, result: rule } = useCombinedRule(identifier, identifier?.ruleSourceName); const runner = useMemo(() => new AlertingQueryRunner(), []); const data = useObservable(runner.get()); const queries2 = useMemo(() => alertRuleToQueries(rule), [rule]); @@ -86,7 +87,7 @@ export function RuleViewer({ match }: RuleViewerProps) { ); }, []); - if (!sourceName) { + if (!identifier?.ruleSourceName) { return ( @@ -96,7 +97,7 @@ export function RuleViewer({ match }: RuleViewerProps) { ); } - const rulesSource = getRulesSourceByName(sourceName); + const rulesSource = getRulesSourceByName(identifier.ruleSourceName); if (loading) { return (