fix(matching): use UUID instead of numeric index for scores
Fix critical bug where PlayerStatusBar was looking up scores and consecutiveMatches by numeric index (1, 2, 3...) instead of by player UUID. This caused all scores and streaks to show as 0 in multiplayer games. The game state stores scores keyed by UUID strings, not numeric indices, so we need to use player.id for the lookup. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,13 +19,13 @@ export function PlayerStatusBar({ className }: PlayerStatusBarProps) {
|
||||
.filter((p): p is NonNullable<typeof p> => p !== undefined)
|
||||
|
||||
// Map active players to display data with scores
|
||||
// State uses numeric player IDs (1, 2, 3...), so we map by index
|
||||
const activePlayers = activePlayersData.map((player, index) => ({
|
||||
// State uses UUID player IDs, so we map by player.id
|
||||
const activePlayers = activePlayersData.map((player) => ({
|
||||
...player,
|
||||
displayName: player.name,
|
||||
displayEmoji: player.emoji,
|
||||
score: state.scores[index + 1] || 0,
|
||||
consecutiveMatches: state.consecutiveMatches?.[index + 1] || 0,
|
||||
score: state.scores[player.id] || 0,
|
||||
consecutiveMatches: state.consecutiveMatches?.[player.id] || 0,
|
||||
}))
|
||||
|
||||
// Get celebration level based on consecutive matches
|
||||
|
||||
Reference in New Issue
Block a user