From 49e3717c5cd572ceb3f2f97588b49e6965a79210 Mon Sep 17 00:00:00 2001 From: Wouter Roozeleer Date: Mon, 18 Dec 2023 22:48:46 +0100 Subject: [PATCH 1/2] fix: swr, tanstack and client should not have generics --- .../src/components/Mutation.tsx | 2 +- .../swagger-tanstack-query/src/components/Query.tsx | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/swagger-tanstack-query/src/components/Mutation.tsx b/packages/swagger-tanstack-query/src/components/Mutation.tsx index 7e4dd26fb..7d52969a8 100644 --- a/packages/swagger-tanstack-query/src/components/Mutation.tsx +++ b/packages/swagger-tanstack-query/src/components/Mutation.tsx @@ -98,7 +98,7 @@ function Template({ } return ( - + {` const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} diff --git a/packages/swagger-tanstack-query/src/components/Query.tsx b/packages/swagger-tanstack-query/src/components/Query.tsx index f3b2cff48..632bf0940 100644 --- a/packages/swagger-tanstack-query/src/components/Query.tsx +++ b/packages/swagger-tanstack-query/src/components/Query.tsx @@ -62,7 +62,7 @@ function Template({ if (isV5) { return ( <> - + {` const { query: queryOptions, client: clientOptions = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? ${hook.queryKey} @@ -85,7 +85,7 @@ function Template({ return ( <> - + {` const { query: queryOptions, client: clientOptions = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? ${hook.queryKey} @@ -302,7 +302,6 @@ export function Query({ pluginKey, }) - const generics = new FunctionParams() const params = new FunctionParams() const queryParams = new FunctionParams() const client = { @@ -314,12 +313,6 @@ export function Query({ withHeaders: !!schemas.headerParams?.name, } - generics.add([ - { type: 'TData', default: `${factory.name}["response"]` }, - suspense ? undefined : { type: 'TQueryData', default: `${factory.name}["response"]` }, - { type: `TQueryKey extends QueryKey`, default: queryKeyType }, - ]) - const pathParams = getParams(schemas.pathParams, {}).toString() const resultGenerics = [ `TData`, @@ -402,7 +395,6 @@ export function Query({