laravelista / comments

Native comments for your Laravel application.
MIT License
744 stars 142 forks source link

Loading all comments? #190

Open Yahav opened 2 years ago

Yahav commented 2 years ago

So it seems that you are actually loading ALL the comments from the database before processing the pagination, what would happen in an environment when you have thousands of comments per item?

https://github.com/laravelista/comments/blob/f1c7a476f79b80f0e28ba901436832f773299ee6/resources/views/components/comments.blade.php#L3

mabasic commented 2 years ago

It would probably take a very long time or it would timeout or crash 😊

When I built this package my primary concern was n+1 queries not the amount of comments.

I agree that it would be better if I could write a sql query which would return comments grouped as they currently are and then we could have db pagination.

This is still probably possible to do, but not for me at this moment. If you are willing to try and submit a PR I would be willing to merge it.