future(homepage): missing addTagTypes results in stale data (#23428)

This commit is contained in:
markkaylor 2025-04-25 11:28:02 +02:00 committed by GitHub
parent 167a9bf54f
commit d08ef457fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,25 +2,29 @@ import * as Homepage from '../../../shared/contracts/homepage';
import { contentManagerApi } from './api'; import { contentManagerApi } from './api';
const homepageService = contentManagerApi.injectEndpoints({ const homepageService = contentManagerApi
/** .enhanceEndpoints({
* TODO: Remove overrideExisting when we remove the future flag addTagTypes: ['RecentDocumentList'],
* and delete the old homepage service in the admin })
*/ .injectEndpoints({
overrideExisting: true, /**
endpoints: (builder) => ({ * TODO: Remove overrideExisting when we remove the future flag
getRecentDocuments: builder.query< * and delete the old homepage service in the admin
Homepage.GetRecentDocuments.Response['data'], */
Homepage.GetRecentDocuments.Request['query'] overrideExisting: true,
>({ endpoints: (builder) => ({
query: (params) => `/content-manager/homepage/recent-documents?action=${params.action}`, getRecentDocuments: builder.query<
transformResponse: (response: Homepage.GetRecentDocuments.Response) => response.data, Homepage.GetRecentDocuments.Response['data'],
providesTags: (res, _err, { action }) => [ Homepage.GetRecentDocuments.Request['query']
{ type: 'RecentDocumentList' as const, id: action }, >({
], query: (params) => `/content-manager/homepage/recent-documents?action=${params.action}`,
transformResponse: (response: Homepage.GetRecentDocuments.Response) => response.data,
providesTags: (res, _err, { action }) => [
{ type: 'RecentDocumentList' as const, id: action },
],
}),
}), }),
}), });
});
const { useGetRecentDocumentsQuery } = homepageService; const { useGetRecentDocumentsQuery } = homepageService;