Skip to content

Commit

Permalink
fix(query): prevent adding duplicate conditions to query (#2027)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Apr 19, 2023
1 parent 12d5a21 commit 2250d2d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/query/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ export const createQuery = <T = ParsedContent>(
}

const query: QueryBuilder<T> = {
params: () => queryParams,
params: () => ({
...queryParams,
...(queryParams.where ? { where: [...ensureArray(queryParams.where)] } : {}),
...(queryParams.sort ? { sort: [...ensureArray(queryParams.sort)] } : {})
}),
only: $set('only', ensureArray) as () => ReturnType<QueryBuilder<T>['only']>,
without: $set('without', ensureArray),
where: $set('where', (q: any) => [...ensureArray(queryParams.where), ...ensureArray(q)]),
Expand Down

0 comments on commit 2250d2d

Please sign in to comment.