Fix mini-list selection: match flight by date from URL, not allFlights[0]

This commit is contained in:
2026-04-16 23:38:39 +03:00
parent dd47e74670
commit b2a6770143
@@ -152,7 +152,13 @@ export const OnlineBoardDetailsPage: FC<OnlineBoardDetailsPageProps> = ({
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(