nested repeater n+1 query
I have model like "booking", "booking_item", and "booking_item_detail", so I try to create a repeater data while creating new booking
Relationships are HasMany
How can I prevent n+1 query

Solution:Jump to solution
Created issue for the main questions, and others duplicate (that I found) can be resolved when using relationships, not options
GitHub
Duplicate query when using nested repeater (Repeater inside repeate...
Package filament/filament Package Version v4.3 Laravel Version v12.41.1 Livewire Version v3.7.1 PHP Version PHP 8.4.15 Problem description When declaring repeater inside repeater, it duplicate quer...
5 Replies
I believe you need to eager-load it in your resource, like so:
I enabled
Model::automaticallyEagerLoadRelationships(); and I also did like this, but it's sameHmm.. not sure on this sorry! Hopefully somebody else can provide a clearer answer on this.
Try creating a basic reproductive example, makes it easier to investigate.
I think duplicate query, not exactly this example is caused by when using wizard and share fields with relations or select options
For eg: I display
State dropdown for edit only (I don't call it from create) but it still query when I am in create page
Will try to check more and submit an issue with reproduction repoSolution
Created issue for the main questions, and others duplicate (that I found) can be resolved when using relationships, not options
GitHub
Duplicate query when using nested repeater (Repeater inside repeate...
Package filament/filament Package Version v4.3 Laravel Version v12.41.1 Livewire Version v3.7.1 PHP Version PHP 8.4.15 Problem description When declaring repeater inside repeater, it duplicate quer...