Alerting: Fixes incorrect cache invalidation for silences when no silences exist (#92322)

This commit is contained in:
Gilles De Mey
2024-08-28 17:25:10 +01:00
committed by GitHub
parent a2602031c0
commit 9d173ef579
@@ -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<