Skip to content

Commit

Permalink
feat(swr): remove output.orverride.swr.options property (orval-labs…
Browse files Browse the repository at this point in the history
  • Loading branch information
soartec-lab authored Mar 3, 2024
1 parent 3ee6904 commit d94d15d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions docs/src/pages/reference/configuration/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,6 @@ module.exports = {
override: {
swr: {
useInfinite: true,
options: {
dedupingInterval: 10000,
},
},
},
},
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ export type NormalizedOperationOptions = {
contentType?: OverrideOutputContentType;
query?: NormalizedQueryOptions;
angular?: Required<AngularOptions>;
swr?: {
options?: any;
};
swr?: SwrOptions;
operationName?: (
operation: OperationObject,
route: string,
Expand Down Expand Up @@ -360,7 +358,6 @@ export type AngularOptions = {
};

export type SwrOptions = {
options?: any;
useInfinite?: boolean;
swrOptions?: any;
swrMutationOptions?: any;
Expand Down
6 changes: 2 additions & 4 deletions packages/swr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,6 @@ ${doc}export const ${camel(
}\n`
: '';

const defaultSwrOptions = { ...swrOptions.swrOptions, ...swrOptions.options };

const useSwrImplementation = `
export type ${pascal(
operationName,
Expand Down Expand Up @@ -420,9 +418,9 @@ ${doc}export const ${camel(`use-${operationName}`)} = <TError = ${errorType}>(
});
const ${queryResultVarName} = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, ${
defaultSwrOptions
swrOptions.swrOptions
? `{
${stringify(defaultSwrOptions)?.slice(1, -1)}
${stringify(swrOptions.swrOptions)?.slice(1, -1)}
...swrOptions
}`
: 'swrOptions'
Expand Down

0 comments on commit d94d15d

Please sign in to comment.