dotansimha / dotansimha/graphql-code-generator-community
[typescript react-query] unused `pageParamKey` when calling `useInfiniteQuery`.
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
**Describe the bug**
Unused `pageParamKey` in file https://github.com/dotansimha/graphql-code-generator/blob/master/packages/plugins/typescript/react-query/src/fetcher-graphql-request.ts
I think this:
```typescript
return `export const useInfinite${operationName} = <
TData = ${operationResultType},
TError = ${this.visitor.config.errorType}
>(
pageParamKey: keyof ${operationVariablesTypes},
client: GraphQLClient,
${variables},
${options},
headers?: RequestInit['headers']
) =>
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
${generateInfiniteQueryKey(node, hasRequiredVariables)},
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(client, ${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})}, headers)(),
options
);`;
```
should be change to:
```typescript
return `export const useInfinite${operationName} = <
TData = ${operationResultType},
TError = ${this.visitor.config.errorType}
>(
pageParamKey: keyof ${operationVariablesTypes},
client: GraphQLClient,
${variables},
${options},
headers?: RequestInit['headers']
) =>
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
${generateInfiniteQueryKey(node, hasRequiredVariables)},
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(client, ${documentVariableName}, {...variables, [pageParamKey]: metaData.pageParam }, headers)(),
options
);`;
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.