mirror of
https://github.com/strapi/strapi.git
synced 2025-10-15 18:16:24 +00:00
future(homepage): missing addTagTypes results in stale data (#23428)
This commit is contained in:
parent
167a9bf54f
commit
d08ef457fd
@ -2,25 +2,29 @@ import * as Homepage from '../../../shared/contracts/homepage';
|
||||
|
||||
import { contentManagerApi } from './api';
|
||||
|
||||
const homepageService = contentManagerApi.injectEndpoints({
|
||||
/**
|
||||
* TODO: Remove overrideExisting when we remove the future flag
|
||||
* and delete the old homepage service in the admin
|
||||
*/
|
||||
overrideExisting: true,
|
||||
endpoints: (builder) => ({
|
||||
getRecentDocuments: builder.query<
|
||||
Homepage.GetRecentDocuments.Response['data'],
|
||||
Homepage.GetRecentDocuments.Request['query']
|
||||
>({
|
||||
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 homepageService = contentManagerApi
|
||||
.enhanceEndpoints({
|
||||
addTagTypes: ['RecentDocumentList'],
|
||||
})
|
||||
.injectEndpoints({
|
||||
/**
|
||||
* TODO: Remove overrideExisting when we remove the future flag
|
||||
* and delete the old homepage service in the admin
|
||||
*/
|
||||
overrideExisting: true,
|
||||
endpoints: (builder) => ({
|
||||
getRecentDocuments: builder.query<
|
||||
Homepage.GetRecentDocuments.Response['data'],
|
||||
Homepage.GetRecentDocuments.Request['query']
|
||||
>({
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user