@tanstack/router-core 1.121.0 → 1.121.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
- "version": "1.121.0",
3
+ "version": "1.121.12",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -257,6 +257,7 @@ export type {
257
257
  ServerSrr,
258
258
  ClearCacheFn,
259
259
  CreateRouterFn,
260
+ ProcessRouteTreeResult,
260
261
  } from './router'
261
262
 
262
263
  export type {
package/src/router.ts CHANGED
@@ -38,6 +38,7 @@ import type {
38
38
  RouterHistory,
39
39
  } from '@tanstack/history'
40
40
  import type {
41
+ Awaitable,
41
42
  ControlledPromise,
42
43
  NoInfer,
43
44
  NonNullableUpdater,
@@ -290,12 +291,10 @@ export interface RouterOptions<
290
291
  /**
291
292
  * A function that will be called when the router is hydrated.
292
293
  *
293
- * The return value of this function will be serialized and stored in the router's dehydrated state.
294
- *
295
294
  * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
296
295
  * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
297
296
  */
298
- hydrate?: (dehydrated: TDehydrated) => void
297
+ hydrate?: (dehydrated: TDehydrated) => Awaitable<void>
299
298
  /**
300
299
  * An array of route masks that will be used to mask routes in the route tree.
301
300
  *
@@ -3021,13 +3020,18 @@ interface RouteLike {
3021
3020
  }
3022
3021
  }
3023
3022
 
3023
+ export type ProcessRouteTreeResult<TRouteLike extends RouteLike> = {
3024
+ routesById: Record<string, TRouteLike>
3025
+ routesByPath: Record<string, TRouteLike>
3026
+ flatRoutes: Array<TRouteLike>
3027
+ }
3024
3028
  export function processRouteTree<TRouteLike extends RouteLike>({
3025
3029
  routeTree,
3026
3030
  initRoute,
3027
3031
  }: {
3028
3032
  routeTree: TRouteLike
3029
3033
  initRoute?: (route: TRouteLike, index: number) => void
3030
- }) {
3034
+ }): ProcessRouteTreeResult<TRouteLike> {
3031
3035
  const routesById = {} as Record<string, TRouteLike>
3032
3036
  const routesByPath = {} as Record<string, TRouteLike>
3033
3037