From 9d173ef579cd5ae6e007daa808231214849f8d76 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Wed, 28 Aug 2024 18:25:10 +0200 Subject: [PATCH] Alerting: Fixes incorrect cache invalidation for silences when no silences exist (#92322) --- .../features/alerting/unified/api/alertSilencesApi.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/app/features/alerting/unified/api/alertSilencesApi.ts b/public/app/features/alerting/unified/api/alertSilencesApi.ts index 3c361f270a5..b46b20a1938 100644 --- a/public/app/features/alerting/unified/api/alertSilencesApi.ts +++ b/public/app/features/alerting/unified/api/alertSilencesApi.ts @@ -26,8 +26,14 @@ export const alertSilencesApi = alertingApi.injectEndpoints({ accesscontrol: accessControl, }, }), - providesTags: (result) => - result ? result.map(({ id }) => ({ type: 'AlertmanagerSilences', id })) : ['AlertmanagerSilences'], + providesTags: (result) => { + return result + ? [ + ...result.map(({ id }) => ({ type: 'AlertmanagerSilences' as const, id })), + { type: 'AlertmanagerSilences' }, + ] + : [{ type: 'AlertmanagerSilences' }]; + }, }), getSilence: build.query<