Open
Description
for example
// http GET /admin/post.json
// response json: {"post": {"id": 123, "title": "the post"}}
type Post = {
id: number;
title: string;
}
type PostResponse = {
post: Post
}
export const api = createApi({
reducerPath: "api",
baseQuery: fetchBaseQuery(),
endpoints: (builder) => ({
getPost: builder.query<Post, void>({
query: () => `/admin/post.json`,
transformResponse: (response: PostResponse) => response.post,
providesTags: ["post"],
})
})
})
// Some where in the app
const updatedPost = {
id: 123,
title: "My Post"
}
dispatch(api.util.upsertQueryData("getPost", updatedPost)); // this not work, undefined body dispatch
I see it is breaking change from version 2.6.0, i also comment on the commit
Metadata
Metadata
Assignees
Labels
No labels