From 2bfd5d2bda7f7d2d83c69f75600ab461fde15d92 Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Wed, 22 Oct 2025 10:45:25 -0500 Subject: [PATCH] fix(complement-race): show only first active player's passengers on train MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In multiplayer steam sprint games, the train was displaying passengers from all players (including inactive ones) instead of only showing passengers belonging to the first active player. The issue was that boardedPassengers was filtering for any claimed passenger, not checking if the claiming player was still active. Changes to SteamTrainJourney.tsx: - Filter boardedPassengers to only include passengers where claimedBy matches the firstActivePlayer's ID - Add firstActivePlayer.id to the useMemo dependency array - Update comment to clarify filtering logic Now the train correctly displays only the first active player's passengers in their train cars, matching the player emoji shown as the engineer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/RaceTrack/SteamTrainJourney.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/arcade/complement-race/components/RaceTrack/SteamTrainJourney.tsx b/apps/web/src/app/arcade/complement-race/components/RaceTrack/SteamTrainJourney.tsx index 8b013c07..3c49684e 100644 --- a/apps/web/src/app/arcade/complement-race/components/RaceTrack/SteamTrainJourney.tsx +++ b/apps/web/src/app/arcade/complement-race/components/RaceTrack/SteamTrainJourney.tsx @@ -164,9 +164,14 @@ export function SteamTrainJourney({ // Memoize filtered passenger lists to avoid recalculating on every render // Arcade room multiplayer uses claimedBy/deliveredBy instead of isBoarded/isDelivered + // Only show passengers claimed by the first active player const boardedPassengers = useMemo( - () => displayPassengers.filter((p) => p.claimedBy !== null && p.deliveredBy === null), - [displayPassengers] + () => + displayPassengers.filter( + (p) => + p.claimedBy === firstActivePlayer?.id && p.claimedBy !== null && p.deliveredBy === null + ), + [displayPassengers, firstActivePlayer?.id] ) const nonDeliveredPassengers = useMemo(