© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
Jon Mason

Theoretical/Performance Question

Let's say I have a livewire component that's a list of items. The list has a foreach loop that iterates through livewire component items in the list.

So something like this:

@foreach($list as $item)
  <livewire:my-component ...
@endforeach
@foreach($list as $item)
  <livewire:my-component ...
@endforeach


In the above scenario, which is generally going to be the most performant?

1) Pass in the ID of the item and query the database within the item component to get any add'l fields.
2) Pass in the entire $item. This would mean you're passing a much larger object, but you're not querying the database for each item.
3) Query once in the outer list component and pass in an array of only the necessary data elements to each item?

I was doing #2 and having performance issues, so I moved to #1, also performance issues. I've also tried passing in each individual field that's needed, which is generally better performance-wise, but if I need almost all the fields on the object, then I'm passing in a ton of fields.

How do you guys generally handle these types of challenges? Hitting some walls performance-wise with Filament and I feel confident it's my own lack of skills and not the framework itself.
Solution
Definitely 3. Otherwise you’re going to have n+1 issues. But I say that not knowing the functionality of the repeated component.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Performance question
FilamentFFilament / ❓┊help
9mo ago
Concept question how to create a decision questionair
FilamentFFilament / ❓┊help
3y ago
performance issues
FilamentFFilament / ❓┊help
5mo ago
testing performance
FilamentFFilament / ❓┊help
12mo ago