Skip to content

Commit

Permalink
fix: product pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
fPolic committed Oct 2, 2024
1 parent a58f0ba commit 1844902
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/data/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const getProductsList = cache(async function ({
queryParams?: HttpTypes.FindParams & HttpTypes.StoreProductParams
}> {
const limit = queryParams?.limit || 12
const offset = (pageParam - 1) * limit

This comment has been minimized.

Copy link
@yannickschuchmann

yannickschuchmann Oct 27, 2024

@fPolic heyhey, I had to revert this change back to (pageParam - 1)... Otherwise it starts with a default offset of 12 on page 1 which is not what we want.

What was the reason for the change?

const offset = pageParam * limit
const region = await getRegion(countryCode)

if (!region) {
Expand All @@ -63,6 +63,7 @@ export const getProductsList = cache(async function ({
nextPage: null,
}
}

return sdk.store.product
.list(
{
Expand Down

0 comments on commit 1844902

Please sign in to comment.