Skip to content

Commit d6f4835

Browse files
giubattsaihaj
andauthored
[typescript react-query] remove unused pageParamKey on infinite queries (#324)
* remove unused pageParamKey on infinite queries * add changeset * Update .changeset/chatty-shrimps-greet.md * update snapshots --------- Co-authored-by: Saihajpreet Singh <[email protected]>
1 parent cd95291 commit d6f4835

8 files changed

Lines changed: 5 additions & 15 deletions

File tree

.changeset/chatty-shrimps-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/typescript-react-query': major
3+
---
4+
5+
removed unused pageParamKey parameter from infinite queries hook call

dev-test/githunt/types.react-query.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ export const useCommentQuery = <TData = CommentQuery, TError = unknown>(
477477
);
478478
export const useInfiniteCommentQuery = <TData = CommentQuery, TError = unknown>(
479479
dataSource: { endpoint: string; fetchParams?: RequestInit },
480-
pageParamKey: keyof CommentQueryVariables,
481480
variables: CommentQueryVariables,
482481
options?: UseInfiniteQueryOptions<CommentQuery, TError, TData>,
483482
) =>
@@ -521,7 +520,6 @@ export const useInfiniteCurrentUserForProfileQuery = <
521520
TError = unknown,
522521
>(
523522
dataSource: { endpoint: string; fetchParams?: RequestInit },
524-
pageParamKey: keyof CurrentUserForProfileQueryVariables,
525523
variables?: CurrentUserForProfileQueryVariables,
526524
options?: UseInfiniteQueryOptions<CurrentUserForProfileQuery, TError, TData>,
527525
) =>
@@ -566,7 +564,6 @@ export const useFeedQuery = <TData = FeedQuery, TError = unknown>(
566564
);
567565
export const useInfiniteFeedQuery = <TData = FeedQuery, TError = unknown>(
568566
dataSource: { endpoint: string; fetchParams?: RequestInit },
569-
pageParamKey: keyof FeedQueryVariables,
570567
variables: FeedQueryVariables,
571568
options?: UseInfiniteQueryOptions<FeedQuery, TError, TData>,
572569
) =>

packages/plugins/typescript/react-query/src/fetcher-custom-mapper.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export class CustomMapperFetcher implements FetcherRenderer {
5454
operationVariablesTypes: string,
5555
hasRequiredVariables: boolean,
5656
): string {
57-
const pageParamKey = `pageParamKey: keyof ${operationVariablesTypes}`;
5857
const variables = `variables${hasRequiredVariables ? '' : '?'}: ${operationVariablesTypes}`;
5958

6059
const hookConfig = this.visitor.queryMethodMap;
@@ -75,7 +74,6 @@ export class CustomMapperFetcher implements FetcherRenderer {
7574
TData = ${operationResultType},
7675
TError = ${this.visitor.config.errorType}
7776
>(
78-
${pageParamKey},
7977
${variables},
8078
${options}
8179
) =>{

packages/plugins/typescript/react-query/src/fetcher-fetch-hardcoded.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ ${this.getFetchParams()}
8181
TData = ${operationResultType},
8282
TError = ${this.visitor.config.errorType}
8383
>(
84-
pageParamKey: keyof ${operationVariablesTypes},
8584
${variables},
8685
${options}
8786
) =>

packages/plugins/typescript/react-query/src/fetcher-fetch.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function fetcher<TData, TVariables>(endpoint: string, requestInit: RequestInit,
5757
TError = ${this.visitor.config.errorType}
5858
>(
5959
dataSource: { endpoint: string, fetchParams?: RequestInit },
60-
pageParamKey: keyof ${operationVariablesTypes},
6160
${variables},
6261
${options}
6362
) =>

packages/plugins/typescript/react-query/src/fetcher-graphql-request.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ function fetcher<TData, TVariables extends { [key: string]: any }>(client: Graph
4848
TData = ${operationResultType},
4949
TError = ${this.visitor.config.errorType}
5050
>(
51-
pageParamKey: keyof ${operationVariablesTypes},
5251
client: GraphQLClient,
5352
${variables},
5453
${options},

packages/plugins/typescript/react-query/tests/__snapshots__/react-query.spec.ts.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export const useInfiniteTestQuery = <
9494
TError = unknown
9595
>(
9696
dataSource: { endpoint: string, fetchParams?: RequestInit },
97-
pageParamKey: keyof TestQueryVariables,
9897
variables?: TestQueryVariables,
9998
options?: UseInfiniteQueryOptions<TestQuery, TError, TData>
10099
) =>
@@ -221,7 +220,6 @@ export const useInfiniteTestQuery = <
221220
TError = unknown
222221
>(
223222
dataSource: { endpoint: string, fetchParams?: RequestInit },
224-
pageParamKey: keyof TestQueryVariables,
225223
variables?: TestQueryVariables,
226224
options?: UseInfiniteQueryOptions<TestQuery, TError, TData>
227225
) =>
@@ -288,7 +286,6 @@ export const useInfiniteTestQuery = <
288286
TData = TTestQuery,
289287
TError = unknown
290288
>(
291-
pageParamKey: keyof TTestQueryVariables,
292289
variables?: TTestQueryVariables,
293290
options?: UseInfiniteQueryOptions<TTestQuery, TError, TData>
294291
) =>{
@@ -350,7 +347,6 @@ export const useInfiniteTestQuery = <
350347
TData = TTestQuery,
351348
TError = unknown
352349
>(
353-
pageParamKey: keyof TTestQueryVariables,
354350
variables?: TTestQueryVariables,
355351
options?: UseInfiniteQueryOptions<TTestQuery, TError, TData>
356352
) =>{

packages/plugins/typescript/react-query/tests/react-query.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export const useInfiniteTestQuery = <
8888
TError = unknown
8989
>(
9090
dataSource: { endpoint: string, fetchParams?: RequestInit },
91-
pageParamKey: keyof TestQueryVariables,
9291
variables?: TestQueryVariables,
9392
options?: UseInfiniteQueryOptions<TestQuery, TError, TData>
9493
) =>
@@ -264,7 +263,6 @@ export const useTestMutation = <
264263
TData = TTestQuery,
265264
TError = unknown
266265
>(
267-
pageParamKey: keyof TTestQueryVariables,
268266
variables?: TTestQueryVariables,
269267
options?: UseInfiniteQueryOptions<TTestQuery, TError, TData>
270268
) =>{
@@ -360,7 +358,6 @@ export const useTestMutation = <
360358
TData = TTestQuery,
361359
TError = unknown
362360
>(
363-
pageParamKey: keyof TTestQueryVariables,
364361
variables?: TTestQueryVariables,
365362
options?: UseInfiniteQueryOptions<TTestQuery, TError, TData>
366363
) =>{

0 commit comments

Comments
 (0)