Skip to content

Commit

Permalink
Fix skipping first page cursor (#1362)
Browse files Browse the repository at this point in the history
* Fix skipping first page cursor

* Create friendly-apes-compare.md
  • Loading branch information
andrzejewsky authored May 21, 2024
1 parent de70c10 commit 3eaa452
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-apes-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"products-feed": patch
---

Respect the cursor for the first page
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export const getCursors = async ({ client, channel }: { client: Client; channel:

const cursors: Array<string> = [];

const fistCusror = result.data?.productVariants?.pageInfo.endCursor;

if (fistCusror) {
cursors.push(fistCusror);
}

while (result.data?.productVariants?.pageInfo.hasNextPage) {
result = await client
.query(FetchProductCursorsDocument, {
Expand Down

0 comments on commit 3eaa452

Please sign in to comment.