Fetch alertmanager config fresh when using "preview routing"

alerting/cache-bust-preview-routing
Tom Ratcliffe 11 months ago
parent 03f502a94d
commit d1e9b7bf5d
  1. 2
      public/app/features/alerting/unified/hooks/useAlertmanagerConfig.ts

@ -11,6 +11,8 @@ type Options = {
// and remove this hook since it adds little value // and remove this hook since it adds little value
export function useAlertmanagerConfig(amSourceName?: string, options?: Options) { export function useAlertmanagerConfig(amSourceName?: string, options?: Options) {
const fetchConfig = alertmanagerApi.endpoints.getAlertmanagerConfiguration.useQuery(amSourceName ?? '', { const fetchConfig = alertmanagerApi.endpoints.getAlertmanagerConfiguration.useQuery(amSourceName ?? '', {
// we'll disable cache by default to prevent overwriting other changes made since last fetch
refetchOnMountOrArgChange: true,
...options, ...options,
skip: !amSourceName, skip: !amSourceName,
}); });

Loading…
Cancel
Save