Memoize specialty nav and branch lookups to stop per-request N+1.
Deploy Ladill Care / deploy (push) Successful in 28s
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:
@@ -81,12 +81,9 @@
|
||||
// Desk specialists skip this group (redundant single-desk list); dashboard cards remain.
|
||||
if ($permissions->handlesFloorCare($member) && $organization) {
|
||||
$specialtyService = app(\App\Services\Care\SpecialtyModuleService::class);
|
||||
$specialtyService->ensureDefaultModulesProvisioned(
|
||||
$organization,
|
||||
(string) $organization->owner_ref,
|
||||
);
|
||||
if ($specialtyService->shouldShowSpecialtyNav($organization, $member)) {
|
||||
foreach ($specialtyService->enabledModulesForMember($organization, $member) as $item) {
|
||||
$specialtyModulesForNav = $specialtyService->enabledModulesForMember($organization, $member);
|
||||
if ($specialtyModulesForNav !== [] && $specialtyService->shouldShowSpecialtyNav($organization, $member)) {
|
||||
foreach ($specialtyModulesForNav as $item) {
|
||||
$key = $item['key'];
|
||||
$label = $item['definition']['nav_label'] ?? $item['definition']['label'] ?? $key;
|
||||
$nav[] = [
|
||||
|
||||
Reference in New Issue
Block a user