diff --git a/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx b/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx index 544834f3422..890f8b23833 100644 --- a/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx +++ b/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx @@ -213,6 +213,10 @@ export function UnifiedAlertList(props: PanelProps) { const noAlertsMessage = rules.length === 0 ? 'No alerts matching filters' : undefined; + const renderLoading = grafanaRulesLoading || (dispatched && loading && !haveResults); + + const havePreviousResults = Object.values(promRulesRequests).some((state) => state.result); + if ( !contextSrv.hasPermission(AccessControlAction.AlertingRuleRead) && !contextSrv.hasPermission(AccessControlAction.AlertingRuleExternalRead) @@ -225,33 +229,36 @@ export function UnifiedAlertList(props: PanelProps) { return (
- {(grafanaRulesLoading || (dispatched && loading && !haveResults)) && } - {noAlertsMessage &&
{noAlertsMessage}
} -
- {props.options.viewMode === ViewMode.Stat && haveResults && ( - - )} - {props.options.viewMode === ViewMode.List && props.options.groupMode === GroupMode.Custom && haveResults && ( - - )} - {props.options.viewMode === ViewMode.List && props.options.groupMode === GroupMode.Default && haveResults && ( - - )} -
+ {havePreviousResults && noAlertsMessage &&
{noAlertsMessage}
} + {havePreviousResults && ( +
+ {props.options.viewMode === ViewMode.Stat && ( + + )} + {props.options.viewMode === ViewMode.List && props.options.groupMode === GroupMode.Custom && ( + + )} + {props.options.viewMode === ViewMode.List && props.options.groupMode === GroupMode.Default && ( + + )} +
+ )} + {/* loading moved here to avoid twitching */} + {renderLoading && }
);