lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query

Home Page:https://www.npmjs.com/package/@lukemorales/query-key-factory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for TanStack Query v5

lithdew opened this issue · comments

Hi,

I wanted to put up a feature request for support for TanStack Query v5 which makes defaultPageParam mandatory in useInfiniteQuery and exposes pageParam and direction in QueryFnContext.

If there might be interest in supporting it, I would be happy to offer some help too.

any news here?

I have the same issue.

Additionally, I am having some issues with useQueries on v5. Queries that I define through query-key-factory that work fine with useQuery seem to have typing issues with useQueries. See screenshots:

Screenshot 2023-11-28 at 12 13 57 Screenshot 2023-11-28 at 12 14 08

Hey everyone, thank you for the suggestion in adding support for v5 new APIs, unfortunately I've been very busy lately without being able to put too much work into new features (the type system is extremely complex by now, so it takes some effort to add new things and not break things). I'll put this on my radar, but can't guarantee something in the near future.

Also, since there are some changes in APIs for V5, it would probably make sense to have a new major version with support only for v5 instead of adding here and being incompatible with a lot of folks that are still using V4.

@gbyesiltas from what I can see in your TS errors, the queries for useQueries expect some kind of MaybeRef that is making it incompatible with the normal function declaration. I'll need to understand the different signature it is expecting and see how we can make the type declaration compatible with its signature

Update from my side about useQueries, looks like this PR from tanstack-query did fix the typing issue :) 🥳

Hey hey, we're interested in this ;)