199ocero / activity-timeline

Add timelines to custom pages or infolist entries effortlessly. Plus, it teams up smoothly with Spatie Activitylog for easy tracking.
https://filamentphp.com/plugins/jaocero-activity-timeline
MIT License
65 stars 18 forks source link

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

Open d8vjork opened 6 months ago

d8vjork commented 6 months ago

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

SujalRatnaTamrakar commented 6 months ago

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.

199ocero commented 6 months ago

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

d8vjork commented 6 months ago

@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