diff --git a/packages/swr/src/index.ts b/packages/swr/src/index.ts index e85b98178..e70322913 100644 --- a/packages/swr/src/index.ts +++ b/packages/swr/src/index.ts @@ -703,7 +703,9 @@ export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${ export const ${swrMutationFetcherName} = (${swrProps} ${swrMutationFetcherOptions}) => { return (_: string, ${swrMutationFetcherArg}: { arg: Arguments }): ${swrMutationFetcherType} => { return ${operationName}(${httpFnProperties}${ - swrMutationFetcherOptions.length ? ', options' : '' + swrMutationFetcherOptions.length + ? (httpFnProperties.length ? ', ' : '') + 'options' + : '' }); } }\n`; diff --git a/tests/configs/swr.config.ts b/tests/configs/swr.config.ts index 793fb48b4..1b699b4b7 100644 --- a/tests/configs/swr.config.ts +++ b/tests/configs/swr.config.ts @@ -145,4 +145,15 @@ export default defineConfig({ }, }, }, + nestedArrays: { + output: { + target: '../generated/swr/nested-arrays/endpoints.ts', + schemas: '../generated/swr/nested-arrays/model', + client: 'swr', + mock: true, + }, + input: { + target: '../specifications/arrays.yaml', + }, + }, });