Skip to content

Commit bc0a9f0

Browse files
committed
fix for custom ids
1 parent 56347b4 commit bc0a9f0

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/client/components/RouteInfo.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ export const RouteInfo = ({ route: routeToUse, className, openNewRoute, onClose
3030
<>
3131
<Icon onClick={onClose} className="absolute right-2 top-2 cursor-pointer text-red-600" name="X" />
3232

33-
<h1 className="text-xl font-semibold">{routeToUse.url}</h1>
33+
<h1 className="text-xl text-white font-semibold">{routeToUse.url}</h1>
3434
<hr className="mb-4 mt-1" />
3535
<h3>
36-
<span className="text-gray-500">Path:</span> {path}
36+
<span className="text-gray-500">Path:</span>
37+
<span className="text-white"> {path}</span>
3738
</h3>
3839
<h3>
39-
<span className="text-gray-500">Url:</span> {pathToOpen}
40+
<span className="text-gray-500">Url:</span> <span className="text-white">{pathToOpen}</span>
4041
</h3>
4142
</>
4243
)}

src/vite/plugin.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,16 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = (
110110
return [
111111
routeOrRoutes,
112112
...recursiveFlatten(
113-
routeOrRoutes.children.map((child) => ({
114-
...child,
115-
parentId: routeOrRoutes.file.split(".").slice(0, -1).join("."),
116-
}))
113+
routeOrRoutes.children.map((child) => {
114+
const withoutExtension = child.file.split(".").slice(0, -1).join(".")
115+
// remove the trailing ./ and ../
116+
const withoutRelative = withoutExtension.replace(/^\.\//, "").replace(/^\.\.\//, "")
117+
return {
118+
...child,
119+
id: child.id ?? withoutRelative,
120+
parentId: withoutExtension,
121+
}
122+
})
117123
),
118124
]
119125
}

0 commit comments

Comments
 (0)