mirror of
https://github.com/strapi/strapi.git
synced 2025-10-17 02:53:22 +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';
|
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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user