diff --git a/public/app/features/alerting/unified/RuleList.test.tsx b/public/app/features/alerting/unified/RuleList.test.tsx index 3dfb29776c4..e3c4878df2d 100644 --- a/public/app/features/alerting/unified/RuleList.test.tsx +++ b/public/app/features/alerting/unified/RuleList.test.tsx @@ -41,6 +41,7 @@ jest.mock('./api/ruler'); jest.mock('../../../core/hooks/useMediaQueryChange'); jest.spyOn(ruleActionButtons, 'matchesWidth').mockReturnValue(false); jest.mock('app/core/core', () => ({ + ...jest.requireActual('app/core/core'), appEvents: { subscribe: () => { return { unsubscribe: () => {} }; diff --git a/public/app/features/alerting/unified/RuleList.tsx b/public/app/features/alerting/unified/RuleList.tsx index 946c06bb913..4a6d807b44b 100644 --- a/public/app/features/alerting/unified/RuleList.tsx +++ b/public/app/features/alerting/unified/RuleList.tsx @@ -76,11 +76,14 @@ const RuleList = withErrorBoundary( // Trigger data refresh only when the RULE_LIST_POLL_INTERVAL_MS elapsed since the previous load FINISHED const [_, fetchRules] = useAsyncFn(async () => { if (!loading) { - trackRuleListNavigation(); await dispatch(fetchAllPromAndRulerRulesAction(false, { limitAlerts })); } }, [loading, limitAlerts, dispatch]); + useEffect(() => { + trackRuleListNavigation().catch(() => {}); + }, []); + // fetch rules, then poll every RULE_LIST_POLL_INTERVAL_MS useEffect(() => { dispatch(fetchAllPromAndRulerRulesAction(false, { limitAlerts }));