Duplicate queries using custom filter
This:
produces 1 query:
But if I change the closure to a simple
I get duplicate queries. Before the query above, the exact same query is executed 18 times.
I cannot relate the number 18 to anything. It's not the number of select options, or records in the result, or anything else I could think of.
If I do the same
Backtrace of the single query:
Backtrace of the duplicated query:
It's not a problem to always use a closure, I'm just trying to understand what's going on and prevent similar situations.
produces 1 query:
But if I change the closure to a simple
pluck:I get duplicate queries. Before the query above, the exact same query is executed 18 times.
I cannot relate the number 18 to anything. It's not the number of select options, or records in the result, or anything else I could think of.
If I do the same
/* fn() => */ on another filter, the same thing happens and I end up with 36 duplicate queries.Backtrace of the single query:
Backtrace of the duplicated query:
It's not a problem to always use a closure, I'm just trying to understand what's going on and prevent similar situations.