dotansimha / dotansimha/graphql-code-generator-community

typing for useXyzQuery helpers doesn't generate Ref type for variables (typescript-vue-urql plugin)

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

Description

Related to @graphql-codegen/typescript-vue-urql

**Current implementation**

`useQuery` from urlq supports Ref variables
(with internal MaybeRef type as `MaybeRef = T | Ref`)

see following example
```

import { useQuery } from '@urql/vue'
import { ProductListDocument } from '~~/generated/graphql'

const category = ref('fashion')
const { data } = useQuery({
query: ProdudctListDocument,
variables: { category, limit: 10 },
})

```
and such query is reactive. Reloading data every time category ref is changes

But generated helpers `useProductListQuery` in this case accepts only T, not Ref

**Proposed usage**

```

import { useQuery } from '@urql/vue'
import { useProductListQuery } from '~~/generated/graphql'

const category = ref('fashion')
const { data } = useProductListQuery({
variables: { category, limit: 10 },
})

```

There is no reason for it as helpers is only wrapper around useQuery.
(Someone can call this issue a bug instead of feature request)

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.