Closed guratr closed 5 years ago
With only 38 comments with multiple nested comments page started loading in 1+ second. The problem is in https://github.com/laravelista/comments/blob/a44039147b35256308f25be350f49977b75f6909/resources/views/_comment.blade.php#L92 with repeated collection to array convertion.
Replacing @if(array_key_exists($comment->id, $grouped_comments->toArray())) with @if($grouped_comments->has($comment->id))
@if(array_key_exists($comment->id, $grouped_comments->toArray()))
@if($grouped_comments->has($comment->id))
fixes the issue. my page load time dropped to 200ms.
Going to implement this. Thank you.
Fixed with commit cb022e4. Going to publish a release soon
With only 38 comments with multiple nested comments page started loading in 1+ second. The problem is in https://github.com/laravelista/comments/blob/a44039147b35256308f25be350f49977b75f6909/resources/views/_comment.blade.php#L92 with repeated collection to array convertion.
Replacing
@if(array_key_exists($comment->id, $grouped_comments->toArray()))
with@if($grouped_comments->has($comment->id))
fixes the issue. my page load time dropped to 200ms.