Problem
src/api/voting/useGroupVotes.ts:11-67 (fetchGroupVotes) does group_members → votes → profiles as three sequential Supabase calls, manually joining in JS (profiles?.find((p) => p.id === vote.user_id)), instead of a single query with embedded resource selection (the pattern other src/api modules already use, e.g. sets embedding artists).
If the third profiles query errors, the error is only console.error'd and votes are still returned, with username: null for everyone — a silent partial-failure mode baked into the data-fetching layer.
Related but distinct from #161 (N+1 batching across 4 other call sites) — useGroupVotes.ts isn't in that ticket's list; this is a different shape of the same problem (sequential joins vs. per-row queries).
Fix
Replace the three-call manual join with one Supabase query using embedded votes(...)/profiles(...) selects. Let the query error propagate to the caller's error state instead of swallowing it.
Architecture note
Filed from an architecture review (module/interface/depth vocabulary, see /codebase-design).
Problem
src/api/voting/useGroupVotes.ts:11-67(fetchGroupVotes) doesgroup_members→votes→profilesas three sequential Supabase calls, manually joining in JS (profiles?.find((p) => p.id === vote.user_id)), instead of a single query with embedded resource selection (the pattern othersrc/apimodules already use, e.g.setsembeddingartists).If the third
profilesquery errors, the error is onlyconsole.error'd and votes are still returned, withusername: nullfor everyone — a silent partial-failure mode baked into the data-fetching layer.Related but distinct from #161 (N+1 batching across 4 other call sites) —
useGroupVotes.tsisn't in that ticket's list; this is a different shape of the same problem (sequential joins vs. per-row queries).Fix
Replace the three-call manual join with one Supabase query using embedded
votes(...)/profiles(...)selects. Let the query error propagate to the caller's error state instead of swallowing it.Architecture note
Filed from an architecture review (module/interface/depth vocabulary, see
/codebase-design).