@graphql-codegen/typescript-react-apollo 4.3.4 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/visitor.js CHANGED
@@ -329,8 +329,9 @@ export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactH
329
329
  suffix: this._getHookSuffix(nodeName, operationType),
330
330
  useTypesPrefix: false,
331
331
  }) + this.config.hooksSuffix;
332
+ const operationDocComment = 'description' in node ? (0, visitor_plugin_common_1.transformComment)(node.description) : '';
332
333
  const optional = hasRequiredVariables(node) ? '' : '?';
333
- return `export function refetch${operationName}(variables${optional}: ${operationVariablesTypes}) {
334
+ return `${operationDocComment}export function refetch${operationName}(variables${optional}: ${operationVariablesTypes}) {
334
335
  return { query: ${this.getDocumentNodeVariable(node, documentVariableName)}, variables: variables }
335
336
  }`;
336
337
  }
package/esm/visitor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import autoBind from 'auto-bind';
2
2
  import { camelCase, pascalCase } from 'change-case-all';
3
3
  import { Kind } from 'graphql';
4
- import { ClientSideBaseVisitor, DocumentMode, getConfigValue, OMIT_TYPE, } from '@graphql-codegen/visitor-plugin-common';
4
+ import { ClientSideBaseVisitor, DocumentMode, getConfigValue, OMIT_TYPE, transformComment, } from '@graphql-codegen/visitor-plugin-common';
5
5
  const APOLLO_CLIENT_3_UNIFIED_PACKAGE = `@apollo/client`;
6
6
  const GROUPED_APOLLO_CLIENT_3_IDENTIFIER = 'Apollo';
7
7
  function hasRequiredVariables(node) {
@@ -325,8 +325,9 @@ export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactH
325
325
  suffix: this._getHookSuffix(nodeName, operationType),
326
326
  useTypesPrefix: false,
327
327
  }) + this.config.hooksSuffix;
328
+ const operationDocComment = 'description' in node ? transformComment(node.description) : '';
328
329
  const optional = hasRequiredVariables(node) ? '' : '?';
329
- return `export function refetch${operationName}(variables${optional}: ${operationVariablesTypes}) {
330
+ return `${operationDocComment}export function refetch${operationName}(variables${optional}: ${operationVariablesTypes}) {
330
331
  return { query: ${this.getDocumentNodeVariable(node, documentVariableName)}, variables: variables }
331
332
  }`;
332
333
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-react-apollo",
3
- "version": "4.3.4",
3
+ "version": "4.4.0",
4
4
  "description": "GraphQL Code Generator plugin for generating a ready-to-use React Components/HOC/Hooks based on GraphQL operations",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"