Skip to content

Commit

Permalink
fix: useQuery improve override logic (#1212)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Feb 9, 2024
1 parent cb597a6 commit 1aff031
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions packages/query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,16 +1140,24 @@ const generateQueryHook = async (
let implementation = '';
let mutators = undefined;

const isQuery =
(Verbs.GET === verb &&
(override.query.useQuery ||
override.query.useSuspenseQuery ||
override.query.useInfinite ||
override.query.useSuspenseInfiniteQuery)) ||
operationQueryOptions?.useInfinite ||
operationQueryOptions?.useSuspenseInfiniteQuery ||
operationQueryOptions?.useQuery ||
operationQueryOptions?.useSuspenseQuery;
let isQuery =
Verbs.GET === verb &&
(override.query.useQuery ||
override.query.useSuspenseQuery ||
override.query.useInfinite ||
override.query.useSuspenseInfiniteQuery);
if (operationQueryOptions?.useInfinite !== undefined) {
isQuery = operationQueryOptions.useInfinite;
}
if (operationQueryOptions?.useSuspenseInfiniteQuery !== undefined) {
isQuery = operationQueryOptions.useSuspenseInfiniteQuery;
}
if (operationQueryOptions?.useQuery !== undefined) {
isQuery = operationQueryOptions.useQuery;
}
if (operationQueryOptions?.useSuspenseQuery !== undefined) {
isQuery = operationQueryOptions.useSuspenseQuery;
}

if (isQuery) {
const queryKeyMutator = query.queryKey
Expand Down

0 comments on commit 1aff031

Please sign in to comment.