dotansimha / dotansimha/graphql-code-generator-community

[typescript-react-query]: Allow customizing the `querykey` for generated hooks

Open
#509 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

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

When using generated hooks, the generated queryKey is always `['string', variables]` but it doesn't seem to be a way to change this, for our use case, we would need to pass the fetchParams as part of the queryKey as we send an `accessToken` that can change.

**Describe the solution you'd like**

Allow an option in the config to customize the queryKey.

**Describe alternatives you've considered**

Allow a callback in the generated hook to customize the generated key.
Add a boolean option that passes the `dataSource` parameter to the queryKey for `fetch`

**Additional context**

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.