Skip to content

Commit 69448fd

Browse files
fix: execute server route middleware before SSR (#4423)
1 parent 0afecad commit 69448fd

File tree

4 files changed

+197
-131
lines changed

4 files changed

+197
-131
lines changed

packages/router-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export type {
257257
ServerSrr,
258258
ClearCacheFn,
259259
CreateRouterFn,
260+
ProcessRouteTreeResult,
260261
} from './router'
261262

262263
export type {

packages/router-core/src/router.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3020,13 +3020,18 @@ interface RouteLike {
30203020
}
30213021
}
30223022

3023+
export type ProcessRouteTreeResult<TRouteLike extends RouteLike> = {
3024+
routesById: Record<string, TRouteLike>
3025+
routesByPath: Record<string, TRouteLike>
3026+
flatRoutes: Array<TRouteLike>
3027+
}
30233028
export function processRouteTree<TRouteLike extends RouteLike>({
30243029
routeTree,
30253030
initRoute,
30263031
}: {
30273032
routeTree: TRouteLike
30283033
initRoute?: (route: TRouteLike, index: number) => void
3029-
}) {
3034+
}): ProcessRouteTreeResult<TRouteLike> {
30303035
const routesById = {} as Record<string, TRouteLike>
30313036
const routesByPath = {} as Record<string, TRouteLike>
30323037

0 commit comments

Comments
 (0)