Paginate Followers & Following pages
Currently, the My Followers and Following pages show all a patron's subscribers or subscriptions.
https://openlibrary.org/people/mekBot/followers https://openlibrary.org/people/mekBot/following
If a patron has hundreds or thousands of followers, this likely to cause a significant performance issue. Especially considering #9282.
Open Library has a Pager macro that will automatically handle the UI for adding pagination to a view.
Here is a similar example PR which adds the Pager to a page: #6739
In order to switch from the current system (where all followers / subscriptions are rendered), we'll need to change the code to only fetch 25 per page instead of everything, and then also calculate the total number of pages that exist by querying for the total count of followers and dividing it by 25.
Hello! Could I please work on this issue?
Hi @pidgezero-one, sure! Feel free to give it a try and let me know if you have any questions about contributing.
@mekarpeles Is there a recommended way to add 26+ entries to follower/following list for the default (openlibrary) local testing user? I've started a draft PR, but so far I can only verify that the page doesn't break when the list is empty.
(Sorry this took longer than I'd have liked, I picked up this ticket and then got sick!)
@pidgezero-one, I don't know that it's a great idea, but I replied on Slack in #openlibrary-g with an idea that may help, or at least get you going in the right direction.
Thank you @scottbarnes! That was exactly what I needed. The PR is ready now thanks to your suggestion.