Skip to content

Commit 5bce87d

Browse files
committed
Fix child route exports
1 parent 923686f commit 5bce87d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

codegen/lib/connect.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ export const connect = (
5959
const parentPath = route.parentPath ?? ''
6060
routeIndexes[parentPath] ??= new Set()
6161
routeIndexes[parentPath]?.add(`${kebabCase(route.name)}.js`)
62+
63+
const hasChildren = routes.some(
64+
({ path }) => path.startsWith(route.path) && path !== route.path,
65+
)
66+
if (hasChildren) {
67+
routeIndexes[parentPath] ??= new Set()
68+
routeIndexes[parentPath]?.add(`${kebabCase(route.name)}/index.js`)
69+
}
6270
}
6371

6472
for (const [parentPath, routes] of Object.entries(routeIndexes)) {

0 commit comments

Comments
 (0)