Skip to content

Commit 98c0b5c

Browse files
committed
feat: NEEDS FEEDBACK added method to mutationKey to prevent accidental duplicates
1 parent 6c450e2 commit 98c0b5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hook-file.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class HookFile extends ModuleBuilder {
187187
yield ` const queryClient = ${useQueryClient()}();`;
188188
yield ` const ${serviceName} = ${this.context.fn(serviceHookName)}()`;
189189
yield ` return ${useMutation()}({`;
190-
yield ` mutationKey: ${this.buildQueryKey(httpPath, method)},`;
190+
yield ` mutationKey: [${method} ${this.buildQueryKey(httpPath, method)}],`;
191191
yield ` mutationFn: async (${paramsExpression}) => {`;
192192
yield ` const res = await ${serviceName}.${camel(
193193
method.name.value,
@@ -417,7 +417,7 @@ export class HookFile extends ModuleBuilder {
417417
}
418418

419419
if (options?.infinite) {
420-
queryKey.push('{inifinite: true}');
420+
queryKey.push('{infinite: true}');
421421
}
422422

423423
return `[${queryKey.join(', ')}]${

0 commit comments

Comments
 (0)