Skip to content

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Sep 5, 2021

two issues:

  1. The types inferred for the refetch function returned from useInfiniteQuery were wrong, as the input to the function is not of type InfiniteData; It's quite hard to infer the correct type, so making the function generic and defaulting to unknown is the safer choice. Users can now still explicitly provide the generic.

  2. for all other methods on the queryClient, generics were mising and types for pages / allPages were always unknown. Adding a generic to refetchQueries / invalidateQueries / resetQueries that also defaults to unknown fixes that and makes those function easier to work with

two issues:

1) The types inferred for the `refetch` function returned from useInfiniteQuery were wrong, as the input to the function is not of type InfiniteData; It's quite hard to infer the correct type, so making the function generic and defaulting to unknown is the safer choice. Users can now still explicitly provide the generic.

2) for all other methods on the queryClient, generics were mising and types for pages / allPages were always unknown. Adding a generic to refetchQueries / invalidateQueries / resetQueries that also defaults to unknown fixes that and makes those function easier to work with
@vercel
Copy link

vercel bot commented Sep 5, 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/2SpSDFPaq3uQBw4R2DCm1UE7CwaV
✅ Preview: https://react-query-git-fork-tkdodo-feature-refetc-c163f2-tannerlinsley.vercel.app

@TkDodo TkDodo merged commit 873647e into TanStack:master Sep 18, 2021
@TkDodo TkDodo deleted the feature/refetchPage-types branch September 18, 2021 17:31
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.24.0 🎉

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.

2 participants