Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generated useInfiniteQuery assumes pageParam is a number #145

Unanswered
mortware asked this question in Q&A
Discussion options

I'm unsure whether I'm doing something wrong, so feel free to correct me, otherwise I can open this up as an issue.

This command correctly creates all hooks with the exception of the infiniteQueries.ts file.
openapi-rq -i http://localhost:5000/rest/openapi -o ./src/data/api --pageParam after --nextPageParam nextLink

When I examine the generated hooks:
SongService.getSongIdById({ after: pageParam as number, authorization, filter, first, id, orderby, select, xMsApiRole }) as TData
I see an error on the after parameter. It's expecting a string (correct), but this code is brute forcing it to a number (incorrect).

Here's an example of the nextLink value:
"nextLink": "http://localhost:5000/rest/Song?$first=5&$after=W3siRW50aXR5TmFtZSI6IlNvbmciLCJGaWVsZE5hbWUiOiJJZCIsIkZpZWxkVmFsdWUiOiJBQjc4MDlBRC02RkE0LTQ1NkQtQkQ3NS0wM0VCMjcxOTZBMjIiLCJEaXJlY3Rpb24iOjB9XQ=="

My first thought was that this library doesn't support cursor-based pagination, but as it's so widely used, I'd be surprised. Am I doing something wrong?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

@mortware

You’re right, we should also support cursor-based pagination, so I believe we need an option to generate pageParam and nextPageParam as strings. Could you create an issue for this?

You must be logged in to vote
1 reply
Comment options

There was already the issue #146.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /