File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1129,6 +1129,15 @@ const generateQueryHook = async (
1129
1129
isQuery = operationQueryOptions . useSuspenseQuery ;
1130
1130
}
1131
1131
1132
+ // For non-GET operations, only register query OR mutation hooks, not both
1133
+ let isMutation =
1134
+ operationQueryOptions . useMutation || override . query . useMutation ;
1135
+
1136
+ // If both query and mutation are true for a non-GET operation, prioritize query
1137
+ if ( verb !== Verbs . GET && isQuery ) {
1138
+ isMutation = false ;
1139
+ }
1140
+
1132
1141
if ( isQuery ) {
1133
1142
const queryKeyMutator = query . queryKey
1134
1143
? await generateMutator ( {
@@ -1286,11 +1295,6 @@ const generateQueryHook = async (
1286
1295
: undefined ;
1287
1296
}
1288
1297
1289
- let isMutation = verb !== Verbs . GET && override . query . useMutation ;
1290
- if ( operationQueryOptions ?. useMutation !== undefined ) {
1291
- isMutation = operationQueryOptions . useMutation ;
1292
- }
1293
-
1294
1298
if ( isMutation ) {
1295
1299
const mutationOptionsMutator = query . mutationOptions
1296
1300
? await generateMutator ( {
@@ -1365,7 +1369,7 @@ const generateQueryHook = async (
1365
1369
1366
1370
const mutationOptionsFn = `export const ${ mutationOptionsFnName } = <TError = ${ errorType } ,
1367
1371
TContext = unknown>(${ mutationArguments } ): ${ mutationOptionFnReturnType } => {
1368
-
1372
+
1369
1373
${ hooksOptionImplementation }
1370
1374
1371
1375
${
You can’t perform that action at this time.
0 commit comments