Description
Description
Currently pageParam in use infinite query is set to 0 if initialPageParam is undefined. While this makes sense in some cases, the backend my react app is fetching from uses mikro-orms implementation of a cursor, where the cursor is represented by an opaque string rather than a sequential number, so the correct way to get the 1st page in my implementation is to omit a cursor value completely from the request (and then use the response from that query to get the cursor for the subsequent pages).
Currently this library doesn't support that implementation as if I set initialPageParam: undefined
it will set pageParam
to 0 and send api-endpoint?cursor=0
in the http request to my backend api which will throw an error.
Proposal
- Remove the default value of 0 for pageParam. Consequence of this is if a default value of zero is required it must be explicitly set as
initialPageParam: 0
OR - Provide an option to override this default value or omit cursor from the http request
Any other suggestions are welcome.
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)