Skip to content

Fix CI #2120

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

Merged
merged 2 commits into from
Jan 25, 2025
Merged

Fix CI #2120

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gorgeous-moles-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-react-query": patch
---

Fix minor type error with latest version of TanStack Query
1,396 changes: 1,251 additions & 145 deletions packages/openapi-fetch/test/examples/schemas/github.d.ts

Large diffs are not rendered by default.

442 changes: 413 additions & 29 deletions packages/openapi-fetch/test/examples/schemas/stripe.d.ts

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions packages/openapi-react-query/src/index.ts
Original file line number Diff line number Diff line change
@@ -217,15 +217,11 @@ export default function createClient<Paths extends {}, Media extends MediaType =
useSuspenseQuery(queryOptions(method, path, init as InitWithUnknowns<typeof init>, options), queryClient),
useInfiniteQuery: (method, path, init, options, queryClient) => {
const { pageParamName = "cursor", ...restOptions } = options;

const { queryKey } = queryOptions(method, path, init);
Copy link
Contributor Author

@drwpow drwpow Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This teeeechnically adds a modicum of work, but barely. The other methods were already using this; we’re just dogfooding it here as well.

We probably could improve the queryFn helper to work for useInfiniteQuery but I didn’t want to make too big a change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to make a issue for it?

return useInfiniteQuery(
{
queryKey: [method, path, init] as const,
queryFn: async <Method extends HttpMethod, Path extends PathsWithMethod<Paths, Method>>({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to type this out; it was already inferred correctly

queryKey: [method, path, init],
pageParam = 0,
signal,
}: QueryFunctionContext<QueryKey<Paths, Method, Path>, unknown>) => {
queryKey,
queryFn: async ({ queryKey: [method, path, init], pageParam = 0, signal }) => {
const mth = method.toUpperCase() as Uppercase<typeof method>;
const fn = client[mth] as ClientMethod<Paths, typeof method, Media>;
const mergedInit = {