This PR fixes the bug in product pagination by ensuring that pageParam is always valid (i.e., greater than or equal to 1) before calculating the offset. It prevents negative values from being passed to the offset, which was causing a runtime error.
Fix Details:
Instead of just removing -1 from the offset calculation, I used Math.max(1, pageParam) to guarantee that pageParam will always be at least 1. This ensures that the offset calculation is never negative while keeping the existing logic intact.
Fixes #9432
This PR fixes the bug in product pagination by ensuring that pageParam is always valid (i.e., greater than or equal to 1) before calculating the offset. It prevents negative values from being passed to the offset, which was causing a runtime error.
Fix Details: Instead of just removing -1 from the offset calculation, I used Math.max(1, pageParam) to guarantee that pageParam will always be at least 1. This ensures that the offset calculation is never negative while keeping the existing logic intact.