Open dumbbaldmonkey opened 4 years ago
I believe this PR addresses your concerns (I ran into this issue myself): https://github.com/fknop/hapi-pagination/pull/83
It introduces an boolean option at the root of the configuration to allow for using a zero index when paginating. I've defaulted it to false
in order to ensure backwards-compatibility, and included tests demonstrating the behavior when it is both false
and true
.
@dumbbaldmonkey Looks like the related PR was merged FYI (thanks @fknop!)
When setting a default page of 0, which is what Postgres uses as its first page, the self/preivous links are not working as expected.
The self link is null and the previous link goes to
page=-1
This is due to the
if(!page)
check in the getUri method. Could this be changed to be < the default value? I can make a PR if you think this is a reasonable fix.