File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 5555 "lucide-react" : " ^0.523.0" ,
5656 "tailwindcss" : " ^4.1.10"
5757 }
58- }
58+ }
Original file line number Diff line number Diff line change @@ -81,7 +81,10 @@ const recursiveRoutes = (
8181 LoadingComponent = { LoadingComponent }
8282 />
8383 ) ;
84- if ( acc [ matchedIndex ] ?. [ "children" ] ) {
84+ const layoutExist = acc [ matchedIndex ] ?. [ "Component" ] ;
85+
86+ if ( acc [ matchedIndex ] ?. [ "children" ] || layoutExist ) {
87+ acc [ matchedIndex ] [ "children" ] = acc [ matchedIndex ] ?. [ "children" ] || [ ] ;
8588 acc [ matchedIndex ] [ "children" ] ?. push ( {
8689 index : true ,
8790 Component : RouterComponent ,
@@ -121,7 +124,9 @@ export const useAppRouter = () => {
121124 allRoutes . forEach ( ( element : RouteObject ) => {
122125 if ( element . path === "/" ) {
123126 element . ErrorBoundary = ErrorElement ;
124- element ?. children ?. push ( catchAllRoute ) ;
127+ if ( element ?. children ?. findIndex ( ( r ) => r . path === "*" ) === - 1 ) {
128+ element ?. children ?. push ( catchAllRoute ) ;
129+ }
125130 }
126131 } ) ;
127132 return allRoutes satisfies RouteObject [ ] ;
You can’t perform that action at this time.
0 commit comments