rametta / rapini

:leafy_green: OpenAPI to React Query (or SWR) & Axios
Apache License 2.0
152 stars 18 forks source link

(Suggestion) - Conditional support for UseInfiniteQuery #41

Closed chihabhajji closed 1 year ago

chihabhajji commented 1 year ago

https://github.com/rametta/rapini/blob/7f062e1965591baf36f0dfdea63dc78f3347f0e5/src/react-query/queries.ts#L103

First of all, thank you so much for the awesome life and time saving lib, as the "DX guy" in my team, this is my bread and butter.

So as the title suggests, adding support for the use of paginatable or on scroll infninite query based on either a config file, for example "infiniteQueryRoutes": ['OperationId(bad idea since not unique / or route'....]

i know this will require the backend to follow some rules, both for hashing the query key (so either the pagination relies on the path params or specific tokens in the query like skip sort limit ....)

rametta commented 1 year ago

Hi @chihabhajji, thanks for opening the issue. Do you have any suggestions/proposals for exactly how you think the infinite queries should be supported? Right now we don't use a config file, instead we use CLI arguments for customization instead, so this proposal should keep that in mind if possible.

I agree that this could be useful to support, but it should be in a seamless way because the lib already provides a lot of what's needed to just do infinite queries in userland by importing the generated requests, query keys and types from the already generated rapini package