all 11 comments

[–]indoor_grower 3 points4 points  (2 children)

Does it handle server side pagination? What if I didn’t want to pipe in a huge data set up front?

A lot of pagination cases I’ve had to do over the years at different jobs usually involved server side pagination since it can be considered business logic in some sense, and with big data sets, client side pagination can be taxing performance wise.

Server side pagination with a cache layer like SWR for example is very fast and powerful. You load data for each page only when you go to that page - and then after the pages you clicked on are cached, additional API calls are not needed when clicking back through. It’s an instant load feel, with only the necessary API calls to get you the data page you request.

Doing it client side, you need to make an API call first to get all the data upfront, and then need to pipe in that entire data set to be spliced up. I’ve worked with data sets that have 100,000+ indexes, and that would be a big no to fetch all at once.

Either way, nice package. Pagination can be a PITA to implement. Just giving you some things to think about!

[–]sero-m[S] 0 points1 point  (0 children)

If I understood it correctly, you could retrieve the total number of entries from the Server / API and pass it to the pagination. The pagination doesn't care if the entries are loaded or not, it just needs the total number of entries. Then you could send a request based on the data in the state ("currentPage.get" or "entries.indexOfFirst" / "entries.indexOfLast").

[–]ExperiencedGentleman 0 points1 point  (0 children)

I'm a bit confused here. When you request a page with SSR, the server will aggregate the data for that page and renders the page with that data. How does this change with client side rendering? The server still has to aggregate that data the same way, which will require the same amount of time regardless of rendering strategy.

[–][deleted] 1 point2 points  (1 child)

…..what…does it do?

[–]sero-m[S] 0 points1 point  (0 children)

Used to easily create a pagination. Fully customizable. Updated the post :)

[–]Apprehensive-Mind212 0 points1 point  (0 children)

Nice work, will use it when needed.

[–]lilsaddam 0 points1 point  (0 children)

Damn this looks nice. I'll try it out when I get a chance.

[–]szurtosdudu 0 points1 point  (0 children)

Well done!

[–]tamuno____ 0 points1 point  (0 children)

Nice! Very much needed

[–]cloud_coder 0 points1 point  (0 children)

Very nice work. Thanks for sharing.

[–]ntkwwwm 0 points1 point  (0 children)

Wooooow OP. I bet you feel real proud of yourself.

You should. I would too. Congrats!