Skip to content

Commit

Permalink
fix(gatsby-source-shopify): fix query pagination (#11752)
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh authored and sidharthachatterjee committed Feb 18, 2019
1 parent 79fc737 commit a82682c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/gatsby-source-shopify/src/lib.js
Expand Up @@ -39,8 +39,8 @@ export const queryAll = async (
path,
query,
first = 250,
after,
aggregatedResponse
after = null,
aggregatedResponse = null
) => {
const data = await queryOnce(client, query, first, after)

Expand All @@ -51,7 +51,7 @@ export const queryAll = async (
? aggregatedResponse.concat(nodes)
: nodes

if (get([...path, `pageInfo`, `hasNextPage`], false, data))
if (get([...path, `pageInfo`, `hasNextPage`], data)) {
return queryAll(
client,
path,
Expand All @@ -60,6 +60,7 @@ export const queryAll = async (
last(edges).cursor,
aggregatedResponse
)
}

return aggregatedResponse
}

0 comments on commit a82682c

Please sign in to comment.