@@ -3,6 +3,7 @@ import type { MouseEvent } from "react"
33import { Link } from "react-router"
44import { useSettingsContext } from "../context/useRDTContext.js"
55import { type ExtendedRoute , constructRoutePath } from "../utils/routing.js"
6+ import { findParentErrorBoundary } from "../utils/sanitize.js"
67import { Input } from "./Input.js"
78import { Tag } from "./Tag.js"
89import { Icon } from "./icon/Icon.js"
@@ -14,20 +15,22 @@ interface RouteInfoProps {
1415 onClose ?: ( ) => void
1516}
1617
17- export const RouteInfo = ( { route, className, openNewRoute, onClose } : RouteInfoProps ) => {
18+ export const RouteInfo = ( { route : routeToUse , className, openNewRoute, onClose } : RouteInfoProps ) => {
19+ const route = window . __reactRouterManifest ?. routes [ routeToUse . id ] || routeToUse
1820 const { settings, setSettings } = useSettingsContext ( )
1921 const { routeWildcards, routeViewMode } = settings
20- const { hasWildcard, path, pathToOpen } = constructRoutePath ( route , routeWildcards )
22+ const { hasWildcard, path, pathToOpen } = constructRoutePath ( routeToUse , routeWildcards )
2123 const isTreeView = routeViewMode === "tree"
22- const hasParentErrorBoundary = route . errorBoundary . errorBoundaryId && route . errorBoundary . errorBoundaryId !== route . id
23- const hasErrorBoundary = route . errorBoundary . hasErrorBoundary
24+ const { hasErrorBoundary, errorBoundaryId } = findParentErrorBoundary ( route )
25+ const hasParentErrorBoundary = errorBoundaryId && errorBoundaryId !== route . id
26+
2427 return (
2528 < div className = { clsx ( className , "relative" ) } >
2629 { isTreeView && (
2730 < >
2831 < Icon onClick = { onClose } className = "absolute right-2 top-2 cursor-pointer text-red-600" name = "X" />
2932
30- < h1 className = "text-xl font-semibold" > { route . url } </ h1 >
33+ < h1 className = "text-xl font-semibold" > { routeToUse . url } </ h1 >
3134 < hr className = "mb-4 mt-1" />
3235 < h3 >
3336 < span className = "text-gray-500" > Path:</ span > { path }
@@ -41,12 +44,19 @@ export const RouteInfo = ({ route, className, openNewRoute, onClose }: RouteInfo
4144 < span className = "whitespace-nowrap text-gray-500" > Route file:</ span >
4245 { route . id }
4346 </ div >
47+
4448 < div className = "mb-4 mt-4 flex flex-col gap-2" >
4549 < span className = "text-gray-500" > Components contained in the route:</ span >
46- < div className = "flex gap-2" >
50+ < div className = "flex flex-wrap gap-2" >
4751 < Tag className = "h-max" color = { route . hasLoader ? "GREEN" : "RED" } >
4852 Loader
4953 </ Tag >
54+ < Tag className = "h-max" color = { route . hasClientLoader ? "GREEN" : "RED" } >
55+ Client Loader
56+ </ Tag >
57+ < Tag className = "h-max" color = { route . hasClientAction ? "GREEN" : "RED" } >
58+ Client Action
59+ </ Tag >
5060 < Tag className = "h-max" color = { route . hasAction ? "GREEN" : "RED" } >
5161 Action
5262 </ Tag >
@@ -60,17 +70,15 @@ export const RouteInfo = ({ route, className, openNewRoute, onClose }: RouteInfo
6070 </ div >
6171 { hasErrorBoundary ? (
6272 < div className = "mr-2" >
63- { hasParentErrorBoundary
64- ? `Covered by parent ErrorBoundary located in: ${ route . errorBoundary . errorBoundaryId } `
65- : "" }
73+ { hasParentErrorBoundary ? `Covered by parent ErrorBoundary located in: ${ errorBoundaryId } ` : "" }
6674 </ div >
6775 ) : null }
6876 </ div >
6977 { hasWildcard && (
7078 < >
7179 < p className = "mb-2 text-gray-500" > Wildcard parameters:</ p >
7280 < div className = { clsx ( "mb-4 grid w-full grid-cols-2 gap-2" , isTreeView && "grid-cols-1" ) } >
73- { route . url
81+ { routeToUse . url
7482 . split ( "/" )
7583 . filter ( ( p ) => p . startsWith ( ":" ) )
7684 . map ( ( param ) => (
0 commit comments