getStateUsing() called 3 times on first load
Hey there,
I just investigated some performance issues and noticed that each table that uses
getStateUsing()
has this function 3 times called on loading the table. So each query inside gets also executed 3 times! Why?
Simple Example:
7 Replies
Since I think now it is a bug after some hours of investigation, I reported this on GitHub https://github.com/filamentphp/filament/issues/14852
GitHub
Query inside getStateUsing called 3 times per row · Issue #14852 · ...
Package filament/tables Package Version v3.2.124 Laravel Version v11.33.2 Livewire Version default PHP Version 8.3.13 Problem description When using ->getStateUsing() to fill a column with a cus...
@btx not sure if the problem is that u r making a query for each row to get the products count
https://filamentphp.com/docs/3.x/tables/columns/relationships#counting-relationships
Yea this would solve to problem for this specific example, but not when requiring any specialized query oder calculation for the colum, since the Closure is still called 3 times
then idk, it may be debugbar
its also replicateable when logging the calls to log file
when u tested it, u disabled debugbar?
I just checked with disabled debugbar, just with file logging, still 3 calls logged. I have a slight suspicion that this might be one of the reasons why the overall performance of v3 has become so much worse compared to v2. I just upgraded to M4 Pro, where I can't notice the lags anymore. But performance of v3 wasn't satisfying on my old 2019 MBP and i5-11400 desktop, and also its not in production.