Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite query matchFulfilled returns wrong type #4859

Closed
Dirard opened this issue Feb 24, 2025 · 4 comments · Fixed by #4869
Closed

infinite query matchFulfilled returns wrong type #4859

Dirard opened this issue Feb 24, 2025 · 4 comments · Fixed by #4869

Comments

@Dirard
Copy link

Dirard commented Feb 24, 2025

// api
getInfinityScrollThreads: build.infiniteQuery<GetPostsResponse, Args, number>

// slice
extraReducers: (builder) => {
    builder.addMatcher(api.endpoints.getInfiniteQueryPosts.matchFulfilled, (state, action) => {
       const payload = action.payload <-- shows up as GetPostsResponse but is actually { pages: GetPostsResponse[], pageParams: number[] }
    }

@markerikson Maybe I'm doing something wrong?

@markerikson
Copy link
Collaborator

No, that's presumably an actual bug - I didn't think to update the types for the matchers there. Thanks for catching this!

@Dirard
Copy link
Author

Dirard commented Feb 25, 2025

No, that's presumably an actual bug - I didn't think to update the types for the matchers there. Thanks for catching this!

same issue:

providesTags: (result: { pages: GetPostsResponse[], pageParams: number[] }) => []

@markerikson
Copy link
Collaborator

Out in https://github.com/reduxjs/redux-toolkit/releases/tag/v2.6.1 !

@nzaytsev
Copy link

@markerikson -

Out in https://github.com/reduxjs/redux-toolkit/releases/tag/v2.6.1 !

I've installed 2.6.1, but I still see wrong types in matchFulfilled. What could be wrong?

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants