@@ -111,16 +111,13 @@ const setRouteLayoutContext = (
111111
112112 file . endpoints = [ ] // TODO
113113
114- file . namespaces = blueprint . namespaces
114+ file . subroutes = [ ...blueprint . routes , ...blueprint . namespaces ]
115+ . sort ( ( n1 , n2 ) => n1 . name . localeCompare ( n2 . name ) )
115116 . filter ( ( { parentPath } ) => parentPath === ( node ?. path ?? null ) )
116- . map ( ( r ) => getSubrouteLayoutContextFromNamespace ( r ) )
117-
118- file . subroutes = blueprint . routes
119- . filter ( ( { parentPath } ) => parentPath === ( node ?. path ?? null ) )
120- . map ( ( r ) => getSubrouteLayoutContextFromRoute ( r ) )
117+ . map ( ( r ) => getSubrouteLayoutContext ( r ) )
121118}
122119
123- const getSubrouteLayoutContextFromRoute = (
120+ const getSubrouteLayoutContext = (
124121 route : Pick < Route , 'path' | 'name' > ,
125122) : SubrouteLayoutContext => {
126123 return {
@@ -129,12 +126,3 @@ const getSubrouteLayoutContextFromRoute = (
129126 className : getClassName ( route . path ) ,
130127 }
131128}
132-
133- const getSubrouteLayoutContextFromNamespace = (
134- namespace : Namespace ,
135- ) : SubrouteLayoutContext => {
136- return {
137- ...getSubrouteLayoutContextFromRoute ( namespace ) ,
138- fileName : `${ kebabCase ( namespace . name ) } /index.js` ,
139- }
140- }
0 commit comments