Problem
Four call sites fire one Supabase request per array item inside Promise.all(items.map(async ...)) instead of a single batched query:
src/api/groups/useUserGroups.ts:44-59 (addMemberCounts) — one count query per group.
src/api/groups/useGroupMembers.ts:25-41 — one profiles query per member.
src/api/admin-roles/useAdminRolesQuery.ts:23-36 — one profiles query per admin role.
src/pages/admin/Analytics/AnalyticsTable.tsx:45-57 and :71-83 — one count query per group and per user.
Fix
Replace with a single .in("id", ids) (or .in("group_id", ids) + client-side grouping via Map) call at each site. Same shape of fix everywhere; real latency win as groups/admins/users grow. Can be combined with the AnalyticsTable.tsx → src/api/ refactor ticket since it touches the same file.
Problem
Four call sites fire one Supabase request per array item inside
Promise.all(items.map(async ...))instead of a single batched query:src/api/groups/useUserGroups.ts:44-59(addMemberCounts) — onecountquery per group.src/api/groups/useGroupMembers.ts:25-41— oneprofilesquery per member.src/api/admin-roles/useAdminRolesQuery.ts:23-36— oneprofilesquery per admin role.src/pages/admin/Analytics/AnalyticsTable.tsx:45-57and:71-83— onecountquery per group and per user.Fix
Replace with a single
.in("id", ids)(or.in("group_id", ids)+ client-side grouping viaMap) call at each site. Same shape of fix everywhere; real latency win as groups/admins/users grow. Can be combined with theAnalyticsTable.tsx→src/api/refactor ticket since it touches the same file.