Skip to content

Commit 49d7556

Browse files
authored
fix(svelte): prefetch correctly (orval-labs#2740)
1 parent 5bf080b commit 49d7556

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

packages/query/src/query-generator.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ const generatePrefetch = ({
9999
queryOptionsFnName,
100100
queryProperties,
101101
isRequestOptions,
102-
hasSvelteQueryV6,
103102
}: {
104103
operationName: string;
105104
mutator?: GeneratorMutator;
@@ -116,7 +115,6 @@ const generatePrefetch = ({
116115
queryOptionsFnName: string;
117116
queryProperties: string;
118117
isRequestOptions: boolean;
119-
hasSvelteQueryV6: boolean;
120118
}) => {
121119
const shouldGeneratePrefetch =
122120
usePrefetch &&
@@ -157,11 +155,7 @@ const generatePrefetch = ({
157155
queryProperties ? ',' : ''
158156
}${isRequestOptions ? 'options' : 'queryOptions'})
159157
160-
await queryClient.${prefetchFnName}(${
161-
hasSvelteQueryV6
162-
? `() => ({ ...${queryOptionsVarName} })`
163-
: queryOptionsVarName
164-
});
158+
await queryClient.${prefetchFnName}(${queryOptionsVarName});
165159
166160
return queryClient;
167161
}\n`;
@@ -527,12 +521,9 @@ export function ${queryHookName}<TData = ${TData}, TError = ${errorType}>(\n ${q
527521
useInfinite,
528522
operationName,
529523
mutator,
530-
queryProps: hasSvelteQueryV6
531-
? queryProps.replace(':', ': () => ')
532-
: queryProps,
524+
queryProps,
533525
dataType,
534526
errorType,
535-
hasSvelteQueryV6,
536527
queryArguments,
537528
queryOptionsVarName,
538529
queryOptionsFnName,

0 commit comments

Comments
 (0)