199ocero/activity-timeline

Use pagination so huge relationships lists doesn't kill the server

d8vjork opened this issue · 3 comments

What happened?

The timeline is loaded as a whole while it should limit the result by the number of entries or let the developer decide

How to reproduce the bug

Have a model with a another related having 1000 entries or more (it loads fast, but should be loaded by chunks aka paginated)

Package Version

1.2.7

PHP Version

8.3.2

Laravel Version

10

Which operating systems does with happen with?

No response

Notes

No response

Hello, I've added pagination in my fork. I feel like it isn't clean enough. If anybody wants is up for cleaning and creating a PR. Please feel free to do it.

Hello @SujalRatnaTamrakar you can PR it to this repo if you want.

@SujalRatnaTamrakar That looks promising, I would suggest using a cursorPaginator as the UI of this package is more driven to an infinite loading but based on clicking that "Load more"

Also cursorPaginate() is better performance-wise

https://github.com/SujalRatnaTamrakar/activity-timeline/blob/a6250661f9d204ca4ca6181acc617ef443f6b281/src/Concerns/HasSetting.php#L119