Skip to content

Conversation

@flybayer
Copy link
Contributor

@flybayer flybayer commented Apr 13, 2021

Closes: #2095

This fixes the useInfiniteQuery suspense bug where options.behavior was missing and so infiniteQueryBehavior.onFetch was not being called, resulting incorrect query data.

@vercel
Copy link

vercel bot commented Apr 13, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/7VPS3U8EZsuUoa3L7RjcXX81fD5C
✅ Preview: https://react-query-git-fork-flybayer-2095-tannerlinsley.vercel.app

Comment on lines +106 to +108
expect(states.length).toBe(3)
expect(states[2]).toMatchObject({
data: { pages: [2], pageParams: [undefined] },
Copy link
Contributor Author

@flybayer flybayer Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was surprising to me that states here is length 3 instead of 2, but I'm assuming this is expected.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 13, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3a3ecee:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@boschni
Copy link
Collaborator

boschni commented Apr 14, 2021

Awesome! The behavior was indeed missing but should be added in InfiniteQueryObserver.getOptimisticResult so it will also be fixed for other frameworks

@flybayer
Copy link
Contributor Author

@boschni thanks! I pushed a commit that makes that change. Tests pass, but I had to do a type cast. Not sure if that's ok? If not, can you give some guidance on how to fix?

@boschni
Copy link
Collaborator

boschni commented Apr 14, 2021

lgtm!

@tannerlinsley tannerlinsley merged commit de28254 into TanStack:master Apr 15, 2021
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.13.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useInfiniteQuery with suspense no longer returns pages (3.9.0+)

3 participants