Fix schedule flight details 404: use Modern.js $.tsx splat route convention

The [...flights]/page.tsx catch-all generated an incorrect route pattern
(schedule/:/flights) instead of a React Router splat (schedule/*).

Modern.js convention for catch-all routes is $.tsx at the directory level,
not [...param]/page.tsx. Moved to $.tsx and updated param access to use
the "*" splat key.

Fixes: /ru/schedule/SU0012-20220527 and multi-leg URLs now resolve.
This commit is contained in:
2026-04-16 12:11:59 +03:00
parent b533124e04
commit 9f21634c6f
@@ -49,13 +49,12 @@ function parseFlightSegments(segments: string[]): IScheduleFlightId[] {
}
export default function ScheduleDetailsRoute(): JSX.Element {
const routeParams = useParams<{ flights: string; lang: string }>();
const routeParams = useParams<{ "*": string; lang: string }>();
const locale = routeParams.lang ?? "ru";
const canonicalOrigin = getEnv().PROD_ORIGIN;
// Modern.js catch-all provides the remaining path as a single string
// joined by "/". We split it back to segments.
const rawFlights = routeParams.flights ?? "";
// Modern.js $.tsx splat route provides the remaining path via "*" param.
const rawFlights = routeParams["*"] ?? "";
const segments = rawFlights.split("/").filter(Boolean);
const flights = parseFlightSegments(segments);