Uysim / pagy-cursor

Cursor pagination with pagy for Ruby On Rails
MIT License
126 stars 23 forks source link

Add Pagy#next_position to hold next scroll id #36

Closed AlexMooney closed 2 years ago

AlexMooney commented 2 years ago

I'd like to give my users the next id they need to supply when they're scrolling in my response header, but the pagy instance doesn't store the collection, so we have to save it.

I want to write response.headers["Next-Scroll-Id"] = @pagy.next_position in my ApplicationController instead of adding a line to every controller with pagy results using the collection that comes back.

Thanks for the gem, BTW!

Uysim commented 2 years ago

@AlexMooney currently we already has a additional query for has_more. I think you feature is nice to have but it will effect the performance for the additional query.

AlexMooney commented 2 years ago

Agreed. This is useful for my application but its best avoided in the general use case.