You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of useInfiniteQuery in the generated client forces pagination via a pageParamName, injecting pageParam directly into the query parameters.
Example of the generated usage:
const{ data }=api.useInfiniteQuery("post","/foods",{
body,},{pageParamName: "pageIndex",initialPageParam: 1,getNextPageParam: (lastPage)=>(lastPage.pageIndex)+1,});
Internally, this injects the page parameter like so:
This implementation assumes that pagination is always query-based and can be controlled by injecting pageParam via a named key (e.g., pageIndex). However, this does not work for APIs where pagination is passed in the request body or headers.
Proposal
Introduce a new optional parameter applyPagination:
Description
The current implementation of useInfiniteQuery in the generated client forces pagination via a pageParamName, injecting pageParam directly into the query parameters.
Example of the generated usage:
Internally, this injects the page parameter like so:
This implementation assumes that pagination is always query-based and can be controlled by injecting pageParam via a named key (e.g., pageIndex). However, this does not work for APIs where pagination is passed in the request body or headers.
Proposal
Introduce a new optional parameter applyPagination:
Internally, this function is called to merge pagination data into the request options:
Extra
The text was updated successfully, but these errors were encountered: