diff --git a/src/features/online-board/components/OnlineBoardDetailsPage.tsx b/src/features/online-board/components/OnlineBoardDetailsPage.tsx index 889ab7ef..0e98b55f 100644 --- a/src/features/online-board/components/OnlineBoardDetailsPage.tsx +++ b/src/features/online-board/components/OnlineBoardDetailsPage.tsx @@ -152,7 +152,13 @@ export const OnlineBoardDetailsPage: FC = ({ flights: `${flightId.carrier}${flightId.flightNumber}${flightId.suffix ?? ""}`, dates: `${flightId.date.slice(0, 4)}-${flightId.date.slice(4, 6)}-${flightId.date.slice(6, 8)}`, }; - const { flight, allFlights, loading, error } = useFlightDetails(detailsParams); + const { flight: firstFlight, allFlights, loading, error } = useFlightDetails(detailsParams); + + // Pick the flight matching the URL's flightId (date-based match). The API + // response may contain multiple flights with the same flight number on + // different dates; we need the one the user actually navigated to. + const flight = + allFlights.find((f) => f.flightId.date === flightId.date) ?? firstFlight; // Live updates via SignalR const { flight: liveFlight, connectionStatus } = useLiveFlightDetails(