With pagination, is there a way to check if there'...
# orm-help
s
With pagination, is there a way to check if there's a next page or a previous page, given the point in pagination?
1
f
Depends on whether you’re doing cursor based pagination or not
s
If I am doing cursor based pagination, what would be the approach?
a
Hey there! There isn’t a sure-fire way of knowing without doing a second query, as far as I’m aware. You could check the length of your query results to see if it is equal to the amount specified in your
take
option, but this isn’t a rock-solid approach. A second query to get the next/previous page and then checking the results length is the best bet.
s
Yeah, it's kinda disappointing because other ORMs do provide it. All these little things Prisma is missing ends up becoming a lot of repetitive code.
Yes, right now I am taking the _count and checking from there. Thanks for the help.