Open wannesmatthys opened 4 hours ago
I'm debugging this further, and apparently to generate all the tenant URL's (see photo), it calls
$this->navigationManager = new NavigationManager;
$navigation = $this->navigationManager->get();
in the file HasRoutes.php (line 194). This loads all navigation items (and policies) for every tenant.
Would there be another way to generate this URL maybe?
Package
filament/filament
Package Version
v3.2.124
Laravel Version
v11.32.0
Livewire Version
v3.5.12
PHP Version
PHP 8.3.3
Problem description
When we have multiple teams, filament always does a check of the policies for every team instead of only for the current team. In large applications with lots of teams this can slow down the application a bit.
So for example, here I have a simple filament dashboard with only one Resource "Posts". If I have one Team, this is the output for the Gates in debugbar.
When registering a new Team, it loads the policies (of the navigation?) multiple times.
With 2 teams:
With 3 teams:
And so on
Expected behavior
It should only load the correct policies once.
Steps to reproduce
Clone the repository, create a couple of teams and check the debugbar. Everytime you add a new team, the "Gates" will increase in debugbar.
Reproduction repository (issue will be closed if this is not valid)
https://github.com/wannesmatthys/filament-gates-reproduction
Relevant log output
No response
Donate 💰 to fund this issue