Repeater in repeater eager load
It's possible to eager load nested relationship, like Question hasMany Answers and Answer HasMany Tags and all load in editView like :
If I modify
its loads answers and tags in eagerload and still for each answers query's tags and total is 309 selects..
17 Replies
is this in a resource?
Yep, in QuestionResource
maybe in beforeFill() on the edit page, load the relationships on $this->record
You mean this?
+2 selects
Or how to use in repeater?
nope
Hmm. nope, the same + 2 selects..
im not sure then
Can I make custom page and with blade syntax made my own layout with nested relationships, then, probably save data also need to customize, right?
Ah, so many non standart filament fetures I need.. 😦
I today ran into some performance issues when using nested repeaters. Tried to eager load in the model above but that did not change anything. Will dig a bit to see if I can make it work.
FileUpload
I also have the problem and have not yet found a solution.
Eager Loading only works in the first level.
With the 2+ nested repeater, it reloads every single Eloquent model.
No matter whether I adjust the getEloquentQuery within the $with model or within the resource, it does nothing. It even loads more queries
Can someone with a clue take a look at this?
I have customised the getCachedExistingRecords() function in the repeater component:
As a result, I have less than 50 queries instead of several 100
Just tested it on the project from V2. There is exactly the same bug. But I didn't notice it 😢
Can't anyone help me? 😢
its a bug, what do you want us to do
if its not already reported on github, do so
Sorry I only got time to post the bug on GitHub now.
I'm currently working from 8am to 8pm on a large banking project with FilamentPHP.
https://github.com/filamentphp/filament/issues/9776
GitHub
Eager Loading Bug - 2...n nested Repeater · Issue #9776 · filamentp...
Package filament/filament Package Version v3.0.99 Laravel Version v10.32.1 Livewire Version No response PHP Version PHP 8.* Problem description Eager loading for 2...n nested repeaters does not wor...
@AlexAnder This bug should now be solved.
https://github.com/filamentphp/filament/pull/9802
GitHub
Fix nested Repeater Eager Loading by johnwinkcq · Pull Request #980...
Checks if the relationship is already eagerly loaded, returning itself to avoid querying the database again and causing an N+1 query problem.
Issue/Bug Description: #9776
Changes have been thorou...