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

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

infinite query matchFulfilled returns wrong type #4859

Dirard opened this issue Feb 24, 2025 · 7 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

@markerikson
Copy link
Collaborator

@nzaytsev can you share a repro and show what you're expecting to see there?

@nzaytsev
Copy link

@markerikson - Unfortunatelly, the original error is in private repo. I created a new repo with the same package versions. It's strange, but at the beginning the error couldn't be reproduced. After some complications it's finally reproduced, but now I cannot identify which step caused this error to be reproduced 😄 I'm sorry for useless report, I'll give you any info if I find any regularity

Here is the repo https://github.com/nzaytsev/repro-rtk-type-error
Here is fallen test https://github.com/nzaytsev/repro-rtk-type-error/actions/runs/13849833086/job/38755130320

@markerikson markerikson reopened this Mar 14, 2025
@markerikson
Copy link
Collaborator

Hmm, very strange. I'll try to find time to look into it further.

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

Successfully merging a pull request may close this issue.

4 participants