@graphql-codegen/typescript-react-query 6.1.1 → 6.1.2-alpha-20260304095758-ba55fb7bf1f82cf1202d5f4e96c70180e3ddfe36

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/fetcher.js CHANGED
@@ -52,7 +52,7 @@ class FetcherRenderer {
52
52
  >(${argumentsResult}) => {
53
53
  ${implHookOuter}
54
54
  return ${infiniteQuery.getHook()}<${operationResultType}, TError, TData>(
55
- ${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config, isSuspense), implFetcher)}
55
+ ${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config), implFetcher)}
56
56
  )};`;
57
57
  };
58
58
  return { generateBaseInfiniteQueryHook, variables, options };
@@ -76,7 +76,7 @@ class FetcherRenderer {
76
76
  >(${argumentsResult}) => {
77
77
  ${implHookOuter}
78
78
  return ${query.getHook()}<${operationResultType}, TError, TData>(
79
- ${this.generateQueryFormattedParameters(this.generateQueryKey(config, isSuspense), implFetcher)}
79
+ ${this.generateQueryFormattedParameters(this.generateQueryKey(config), implFetcher)}
80
80
  )};`;
81
81
  };
82
82
  return {
@@ -133,8 +133,8 @@ class FetcherRenderer {
133
133
  }
134
134
  return `options: Omit<${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>, 'queryKey'> & { queryKey?: ${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>['queryKey'] }`;
135
135
  }
136
- generateInfiniteQueryKey(config, isSuspense) {
137
- const identifier = isSuspense ? 'infiniteSuspense' : 'infinite';
136
+ generateInfiniteQueryKey(config) {
137
+ const identifier = 'infinite';
138
138
  if (config.hasRequiredVariables)
139
139
  return `['${config.node.name.value}.${identifier}', variables]`;
140
140
  return `variables === undefined ? ['${config.node.name.value}.${identifier}'] : ['${config.node.name.value}.${identifier}', variables]`;
@@ -145,12 +145,12 @@ class FetcherRenderer {
145
145
  const { operationName, node } = config;
146
146
  return {
147
147
  hook: this.generateInfiniteQueryHook(config, isSuspense),
148
- getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config, isSuspense)};`,
148
+ getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config)};`,
149
149
  rootKey: `${infiniteQuery.getHook(operationName)}.rootKey = '${node.name.value}.infinite';`,
150
150
  };
151
151
  }
152
- generateQueryKey(config, isSuspense) {
153
- const identifier = isSuspense ? `${config.node.name.value}Suspense` : config.node.name.value;
152
+ generateQueryKey(config) {
153
+ const identifier = config.node.name.value;
154
154
  if (config.hasRequiredVariables)
155
155
  return `['${identifier}', variables]`;
156
156
  return `variables === undefined ? ['${identifier}'] : ['${identifier}', variables]`;
@@ -162,7 +162,7 @@ class FetcherRenderer {
162
162
  return {
163
163
  hook: this.generateQueryHook(config, isSuspense),
164
164
  document: `${query.getHook(operationName)}.document = ${documentVariableName};`,
165
- getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config, isSuspense)};`,
165
+ getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config)};`,
166
166
  rootKey: `${query.getHook(operationName)}.rootKey = '${node.name.value}';`,
167
167
  };
168
168
  }
package/esm/fetcher.js CHANGED
@@ -48,7 +48,7 @@ export class FetcherRenderer {
48
48
  >(${argumentsResult}) => {
49
49
  ${implHookOuter}
50
50
  return ${infiniteQuery.getHook()}<${operationResultType}, TError, TData>(
51
- ${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config, isSuspense), implFetcher)}
51
+ ${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config), implFetcher)}
52
52
  )};`;
53
53
  };
54
54
  return { generateBaseInfiniteQueryHook, variables, options };
@@ -72,7 +72,7 @@ export class FetcherRenderer {
72
72
  >(${argumentsResult}) => {
73
73
  ${implHookOuter}
74
74
  return ${query.getHook()}<${operationResultType}, TError, TData>(
75
- ${this.generateQueryFormattedParameters(this.generateQueryKey(config, isSuspense), implFetcher)}
75
+ ${this.generateQueryFormattedParameters(this.generateQueryKey(config), implFetcher)}
76
76
  )};`;
77
77
  };
78
78
  return {
@@ -129,8 +129,8 @@ export class FetcherRenderer {
129
129
  }
130
130
  return `options: Omit<${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>, 'queryKey'> & { queryKey?: ${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>['queryKey'] }`;
131
131
  }
132
- generateInfiniteQueryKey(config, isSuspense) {
133
- const identifier = isSuspense ? 'infiniteSuspense' : 'infinite';
132
+ generateInfiniteQueryKey(config) {
133
+ const identifier = 'infinite';
134
134
  if (config.hasRequiredVariables)
135
135
  return `['${config.node.name.value}.${identifier}', variables]`;
136
136
  return `variables === undefined ? ['${config.node.name.value}.${identifier}'] : ['${config.node.name.value}.${identifier}', variables]`;
@@ -141,12 +141,12 @@ export class FetcherRenderer {
141
141
  const { operationName, node } = config;
142
142
  return {
143
143
  hook: this.generateInfiniteQueryHook(config, isSuspense),
144
- getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config, isSuspense)};`,
144
+ getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config)};`,
145
145
  rootKey: `${infiniteQuery.getHook(operationName)}.rootKey = '${node.name.value}.infinite';`,
146
146
  };
147
147
  }
148
- generateQueryKey(config, isSuspense) {
149
- const identifier = isSuspense ? `${config.node.name.value}Suspense` : config.node.name.value;
148
+ generateQueryKey(config) {
149
+ const identifier = config.node.name.value;
150
150
  if (config.hasRequiredVariables)
151
151
  return `['${identifier}', variables]`;
152
152
  return `variables === undefined ? ['${identifier}'] : ['${identifier}', variables]`;
@@ -158,7 +158,7 @@ export class FetcherRenderer {
158
158
  return {
159
159
  hook: this.generateQueryHook(config, isSuspense),
160
160
  document: `${query.getHook(operationName)}.document = ${documentVariableName};`,
161
- getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config, isSuspense)};`,
161
+ getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config)};`,
162
162
  rootKey: `${query.getHook(operationName)}.rootKey = '${node.name.value}';`,
163
163
  };
164
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-react-query",
3
- "version": "6.1.1",
3
+ "version": "6.1.2-alpha-20260304095758-ba55fb7bf1f82cf1202d5f4e96c70180e3ddfe36",
4
4
  "description": "GraphQL Code Generator plugin for generating a ready-to-use React-Query 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"
@@ -50,13 +50,13 @@ export declare abstract class FetcherRenderer {
50
50
  private generateQueryOptionsSignature;
51
51
  private generateInfiniteQueryVariablesSignature;
52
52
  private generateInfiniteQueryOptionsSignature;
53
- generateInfiniteQueryKey(config: GenerateConfig, isSuspense: boolean): string;
53
+ generateInfiniteQueryKey(config: GenerateConfig): string;
54
54
  generateInfiniteQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
55
55
  hook: string;
56
56
  getKey: string;
57
57
  rootKey: string;
58
58
  };
59
- generateQueryKey(config: GenerateConfig, isSuspense: boolean): string;
59
+ generateQueryKey(config: GenerateConfig): string;
60
60
  generateQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
61
61
  hook: string;
62
62
  document: string;
@@ -50,13 +50,13 @@ export declare abstract class FetcherRenderer {
50
50
  private generateQueryOptionsSignature;
51
51
  private generateInfiniteQueryVariablesSignature;
52
52
  private generateInfiniteQueryOptionsSignature;
53
- generateInfiniteQueryKey(config: GenerateConfig, isSuspense: boolean): string;
53
+ generateInfiniteQueryKey(config: GenerateConfig): string;
54
54
  generateInfiniteQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
55
55
  hook: string;
56
56
  getKey: string;
57
57
  rootKey: string;
58
58
  };
59
- generateQueryKey(config: GenerateConfig, isSuspense: boolean): string;
59
+ generateQueryKey(config: GenerateConfig): string;
60
60
  generateQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
61
61
  hook: string;
62
62
  document: string;