fix(web): prevent landing page from matching nested routes

This commit is contained in:
vsxd 2026-03-13 11:37:22 +08:00
parent 68af8047b8
commit 8171a190a7
2 changed files with 2 additions and 13 deletions

View file

@ -1,6 +1,7 @@
import { Suspense } from 'react'
import { Outlet, Link, useRouterState } from '@tanstack/react-router'
import { useAuth } from '@/features/auth/use-auth'
import { LandingPage } from '@/pages/landing'
export function Layout() {
const { user, isLoading } = useAuth()
@ -8,11 +9,7 @@ export function Layout() {
const isLanding = pathname === '/'
if (isLanding) {
return (
<Suspense fallback={null}>
<Outlet />
</Suspense>
)
return <LandingPage />
}
return (

View file

@ -15,7 +15,6 @@ function lazyRouteComponent<TModule extends Record<string, unknown>>(
return LazyComponent
}
const LandingPage = lazyRouteComponent(() => import('@/pages/landing'), 'LandingPage')
const HomePage = lazyRouteComponent(() => import('@/pages/home'), 'HomePage')
const LoginPage = lazyRouteComponent(() => import('@/pages/login'), 'LoginPage')
const RegisterPage = lazyRouteComponent(() => import('@/pages/register'), 'RegisterPage')
@ -43,12 +42,6 @@ const rootRoute = createRootRoute({
component: Layout,
})
const homeRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: LandingPage,
})
const skillsRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/skills',
@ -303,7 +296,6 @@ const adminAuditLogRoute = createRoute({
})
const routeTree = rootRoute.addChildren([
homeRoute,
skillsRoute,
loginRoute,
registerRoute,