Skip to content

Commit

Permalink
[preview] Fix issue with accumulated queries + default pagination lim…
Browse files Browse the repository at this point in the history
…it (#610)

* [preview] Fix issue with accumulated queries + default pagination limit

* [preview] Ensure no implicit pagination on top level query too
  • Loading branch information
bjoerge committed Feb 22, 2018
1 parent f4d3b0e commit e167b3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@sanity/preview/src/utils/optimizeQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function stringifyId(id: string) {
}

function toSubQuery({ids, paths}) {
return `*[_id in [${ids.map(stringifyId).join(',')}]]{_id,_type,${paths.join(',')}}`
return `*[_id in [${ids.map(stringifyId).join(',')}]][0...${ids.length}]{_id,_type,${paths.join(',')}}`
}

export function toGradientQuery(combinedSelections: CombinedSelection[]) {
return `[${combinedSelections.map(toSubQuery).join(',')}]`
return `[${combinedSelections.map(toSubQuery).join(',')}][0...${combinedSelections.length}]`
}

export function reassemble(queryResult: Result[], combinedSelections: CombinedSelection[]) {
Expand Down

0 comments on commit e167b3e

Please sign in to comment.