From 9f21634c6f8ecca68b2f1b824f777d027b9c7297 Mon Sep 17 00:00:00 2001 From: gnezim Date: Thu, 16 Apr 2026 12:11:59 +0300 Subject: [PATCH] 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. --- .../[lang]/schedule/{[...flights]/page.tsx => $.tsx} | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename src/routes/[lang]/schedule/{[...flights]/page.tsx => $.tsx} (90%) diff --git a/src/routes/[lang]/schedule/[...flights]/page.tsx b/src/routes/[lang]/schedule/$.tsx similarity index 90% rename from src/routes/[lang]/schedule/[...flights]/page.tsx rename to src/routes/[lang]/schedule/$.tsx index 371ad883..f6612899 100644 --- a/src/routes/[lang]/schedule/[...flights]/page.tsx +++ b/src/routes/[lang]/schedule/$.tsx @@ -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);