Skip to content

Commit fe2e9c7

Browse files
charpenin1ru4l
andauthored
fix: use gqlTagName in the autogenerated example (#8995)
Co-authored-by: Laurin Quast <[email protected]>
1 parent 9c600c6 commit fe2e9c7

File tree

17 files changed

+122
-116
lines changed

17 files changed

+122
-116
lines changed

.changeset/nasty-eggs-rule.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphql-codegen/gql-tag-operations': patch
3+
'@graphql-codegen/client-preset': patch
4+
---
5+
6+
Use `gqlTagName` for generated examples

dev-test/gql-tag-operations/graphql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const documents = {
2424
*
2525
* @example
2626
* ```ts
27-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
27+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2828
* ```
2929
*
3030
* The query argument is unknown!

examples/persisted-documents/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const documents = {
2222
*
2323
* @example
2424
* ```ts
25-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
25+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2626
* ```
2727
*
2828
* The query argument is unknown!

examples/react/apollo-client/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/react/babel-optimized/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/react/graphql-request/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/react/nextjs-swr/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/react/tanstack-react-query/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/react/urql/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/typescript-esm/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/typescript-graphql-request/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/vue/apollo-composable/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/vue/urql/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/vue/villus/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const documents = {
2525
*
2626
* @example
2727
* ```ts
28-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
28+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2929
* ```
3030
*
3131
* The query argument is unknown!

examples/yoga-tests/src/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const documents = {
2424
*
2525
* @example
2626
* ```ts
27-
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
27+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
2828
* ```
2929
*
3030
* The query argument is unknown!

packages/plugins/typescript/gql-tag-operations/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const plugin: PluginFunction<{
5454
`/**\n * The ${gqlTagName} function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n`,
5555
` *\n * @example\n`,
5656
' * ```ts\n',
57-
' * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n',
57+
` * const query = ${gqlTagName}` + '(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n',
5858
' * ```\n *\n',
5959
` * The query argument is unknown!\n`,
6060
` * Please regenerate the types.\n`,

0 commit comments

Comments
 (0)