-
-
Notifications
You must be signed in to change notification settings - Fork 294
fix(openapi-ts): fix generated infiniteQueryOptions not work with useSuspenseInfiniteQuery #3205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Enhance the OpenAPI configuration to include pagination options and update the App component to utilize both infinite and suspense infinite queries for fetching pets by tags. Introduce new utility functions for infinite query handling in the generated client code.
|
|
|
|
@manudeli is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
| .pretty() | ||
| .hint('@ts-ignore') | ||
| .prop('initialPageParam', $.object().pretty().as('any')) | ||
| .prop('getNextPageParam', $.func().as('any')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels very dirty. Is the issue that the inferred type doesn't contain initialPageParam and getNextPageParam? Why not add a second argument and require them?
| tags: [], | ||
| }, | ||
| }), | ||
| getNextPageParam: (lastPage) => lastPage.map(({ name }) => name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if you omit this line? Would the types not complain? Would the runtime code likely crash?
| }, | ||
| }), | ||
| getNextPageParam: (lastPage) => lastPage.map(({ name }) => name), | ||
| initialPageParam: { query: { tags: [] } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other reason this smells is if you place this line BEFORE the generated options, it won't get applied. I think we either want to keep options as they were (not setting this property) or require this property if it's needed
fix: #2931