mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: fix moment when rule list navigation is tracked (#68663)
* Track rule list navigation only on page load * update tests * Fix lint --------- Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
parent
d54fa569ec
commit
1763b82b5d
@ -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: () => {} };
|
||||
|
@ -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 }));
|
||||
|
Loading…
Reference in New Issue
Block a user