There was an error while loading. Please reload this page.
1 parent bacd8bc commit b63d3caCopy full SHA for b63d3ca
1 file changed
libs/storefront-data/src/products/pagination.ts
@@ -16,8 +16,13 @@ export function resolvePagination(
16
): PaginationState {
17
const limit = input.limit ?? defaultLimit
18
const offset =
19
- input.offset ?? (input.page ? (input.page - 1) * limit : 0)
20
- const page = input.page ?? (limit > 0 ? Math.floor(offset / limit) + 1 : 1)
+ input.offset ?? (input.page != null ? (input.page - 1) * limit : 0)
+ const page =
21
+ input.offset != null
22
+ ? limit > 0
23
+ ? Math.floor(offset / limit) + 1
24
+ : 1
25
+ : input.page ?? (limit > 0 ? Math.floor(offset / limit) + 1 : 1)
26
27
return { page, limit, offset }
28
}
0 commit comments