Memoize specialty nav and branch lookups to stop per-request N+1.
Deploy Ladill Care / deploy (push) Successful in 28s

Sidebar was re-querying practitioners for every specialty module and also
calling ensureDefaultModulesProvisioned on each page render, which showed
up as multi-second PHP-FPM slow logs on Care.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-19 16:02:16 +00:00
co-authored by Cursor
parent 1d3db4f803
commit b44ed50fe7
4 changed files with 72 additions and 24 deletions
+4 -1
View File
@@ -7,6 +7,7 @@ use App\Listeners\PlatformServiceEventListener;
use App\Models\User;
use App\Services\Care\OrganizationResolver;
use App\Services\Care\PlanService;
use App\Services\Care\SpecialtyModuleService;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Event;
@@ -18,7 +19,9 @@ class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
// Request-scoped memoization for specialty nav / branch scope (avoids N+1 per module).
$this->app->singleton(OrganizationResolver::class);
$this->app->singleton(SpecialtyModuleService::class);
}
public function boot(): void