File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,14 @@ const recursiveRoutes = (
55
55
Component
56
56
) ;
57
57
} else {
58
- acc [ matchedIndex ] [ "Component" ] = Component . default ;
58
+ if ( acc [ matchedIndex ] ?. [ "children" ] ) {
59
+ acc [ matchedIndex ] [ "children" ] ?. push ( {
60
+ index : true ,
61
+ Component : Component . default ,
62
+ } ) ;
63
+ } else {
64
+ acc [ matchedIndex ] [ "Component" ] = Component . default ;
65
+ }
59
66
}
60
67
} ;
61
68
@@ -72,8 +79,6 @@ const allRoutes = Object.entries(routes).reduce(
72
79
. split ( "/" )
73
80
. filter ( Boolean ) ;
74
81
75
- console . log ( routePath , "routePath" ) ;
76
-
77
82
recursiveRoutes ( routePath , acc , Component ) ;
78
83
return acc ;
79
84
} ,
@@ -99,8 +104,6 @@ export const AppRouter = ({ router = createBrowserRouter }) => {
99
104
} ) ;
100
105
const elements = [ ...allRoutes , catchAllRoute ] satisfies RouteObject [ ] ;
101
106
102
- console . log ( elements , "elements" ) ;
103
-
104
107
return < RouterProvider router = { router ( elements ) } /> ;
105
108
} ;
106
109
You can’t perform that action at this time.
0 commit comments