Skip to content

Commit c0d7552

Browse files
committed
Add lower bound of 0 when computing page
1 parent 9967e63 commit c0d7552

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/react/saas-large/src/db/products.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const itemsPerPage = 50
3131

3232
function computePageNumber(limit: number | undefined) {
3333
const effectiveLimit = limit ?? itemsPerPage
34-
return Math.floor(effectiveLimit / itemsPerPage) - 1
34+
return Math.max(0, Math.floor(effectiveLimit / itemsPerPage) - 1)
3535
}
3636

3737
export const productsCollection = createCollection(

0 commit comments

Comments
 (0)