From c5df6312ec95d3f3272e5dc71e9f37a893717e3c Mon Sep 17 00:00:00 2001 From: Ahmed Abdelbaset Date: Sun, 22 Jun 2025 12:33:33 +0300 Subject: [PATCH 1/3] fix(start): redirect from api-routes to server-routes --- src/libraries/start.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libraries/start.tsx b/src/libraries/start.tsx index 4bef4257f..ecf7cd11c 100644 --- a/src/libraries/start.tsx +++ b/src/libraries/start.tsx @@ -5,6 +5,7 @@ import { BiBookAlt } from 'react-icons/bi' import { PiRocketLaunchDuotone, PiTreeStructureBold } from 'react-icons/pi' import { TbServerBolt } from 'react-icons/tb' import { twMerge } from 'tailwind-merge' +import { redirect } from '@tanstack/react-router' const repo = 'tanstack/router' @@ -150,4 +151,13 @@ export const startProject = { ), }, ], + handleRedirects: (href) => { + if ( + href.match(/\/start\/latest\/docs\/framework\/(react|solid)\/api-routes/) + ) { + throw redirect({ + href: href.replace('/api-routes', '/server-routes'), + }) + } + }, } satisfies Library From 813f6977a7b49955f231a87e1586c3b8a7d91c5a Mon Sep 17 00:00:00 2001 From: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com> Date: Mon, 14 Jul 2025 22:30:36 +1200 Subject: [PATCH 2/3] chore: update to support capturing `latest` and `v1` --- src/libraries/start.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/start.tsx b/src/libraries/start.tsx index ecf7cd11c..db986992c 100644 --- a/src/libraries/start.tsx +++ b/src/libraries/start.tsx @@ -153,7 +153,7 @@ export const startProject = { ], handleRedirects: (href) => { if ( - href.match(/\/start\/latest\/docs\/framework\/(react|solid)\/api-routes/) + href.match(/\/start\/(latest|v1)\/docs\/framework\/(react|solid)\/api-routes/) ) { throw redirect({ href: href.replace('/api-routes', '/server-routes'), From 99ab4ee9fc0d9c3b112b958f9887f653fd8986f0 Mon Sep 17 00:00:00 2001 From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com> Date: Mon, 14 Jul 2025 22:32:49 +1200 Subject: [PATCH 3/3] chore: format and add comment --- src/libraries/start.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libraries/start.tsx b/src/libraries/start.tsx index db986992c..95622f65e 100644 --- a/src/libraries/start.tsx +++ b/src/libraries/start.tsx @@ -152,8 +152,11 @@ export const startProject = { }, ], handleRedirects: (href) => { + // Redirect from /api-routes to /server-routes if ( - href.match(/\/start\/(latest|v1)\/docs\/framework\/(react|solid)\/api-routes/) + href.match( + /\/start\/(latest|v1)\/docs\/framework\/(react|solid)\/api-routes/ + ) ) { throw redirect({ href: href.replace('/api-routes', '/server-routes'),