Skip to content

Commit d94d15d

Browse files
authoredMar 3, 2024··
feat(swr): remove output.orverride.swr.options property (#1246)
1 parent 3ee6904 commit d94d15d

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed
 

‎docs/src/pages/reference/configuration/output.md

-3
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,6 @@ module.exports = {
800800
override: {
801801
swr: {
802802
useInfinite: true,
803-
options: {
804-
dedupingInterval: 10000,
805-
},
806803
},
807804
},
808805
},

‎packages/core/src/types.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ export type NormalizedOperationOptions = {
127127
contentType?: OverrideOutputContentType;
128128
query?: NormalizedQueryOptions;
129129
angular?: Required<AngularOptions>;
130-
swr?: {
131-
options?: any;
132-
};
130+
swr?: SwrOptions;
133131
operationName?: (
134132
operation: OperationObject,
135133
route: string,
@@ -360,7 +358,6 @@ export type AngularOptions = {
360358
};
361359

362360
export type SwrOptions = {
363-
options?: any;
364361
useInfinite?: boolean;
365362
swrOptions?: any;
366363
swrMutationOptions?: any;

‎packages/swr/src/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,6 @@ ${doc}export const ${camel(
378378
}\n`
379379
: '';
380380

381-
const defaultSwrOptions = { ...swrOptions.swrOptions, ...swrOptions.options };
382-
383381
const useSwrImplementation = `
384382
export type ${pascal(
385383
operationName,
@@ -420,9 +418,9 @@ ${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(
420418
});
421419
422420
const ${queryResultVarName} = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, ${
423-
defaultSwrOptions
421+
swrOptions.swrOptions
424422
? `{
425-
${stringify(defaultSwrOptions)?.slice(1, -1)}
423+
${stringify(swrOptions.swrOptions)?.slice(1, -1)}
426424
...swrOptions
427425
}`
428426
: 'swrOptions'

0 commit comments

Comments
 (0)
Please sign in to comment.