dotansimha / dotansimha/graphql-code-generator

Pass the client in the codgen.yml, when using graphql-request with react-query

Open
#5,156 1 comment 2 reactions 0 assignees View on GitHub
help wanted kind/enhancement plugins
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Is your feature request related to a problem? Please describe.**

When using `react-query` plugin with `graphql-request`, it requires you to always pass the client in the generated query like in the provided example:
```ts
import { useMyQuery } from './generated';
import { client } from './my-graphql-request-client';

export const MyComponent = () => {
const { status, data, error, isFetching } = useMyQuery(client, {});
};
```

**Describe the solution you'd like**
It would be cool to pass the client in the `codegen.yml`, like for the example you do with the fetch option:
```yml
plugins:
- add:
content: "import { endpointUrl, fetchParams } from './my-config';"
- typescript
- typescript-operations
- typescript-react-query
config:
fetcher:
endpoint: 'endpointUrl'
fetchParams: 'fetchParams'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.