@tanstack/react-router 1.15.7 → 1.15.9
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/dist/cjs/awaited.cjs +33 -5
- package/dist/cjs/awaited.cjs.map +1 -1
- package/dist/cjs/awaited.d.cts +3 -2
- package/dist/cjs/createServerFn.cjs +1 -7
- package/dist/cjs/createServerFn.cjs.map +1 -1
- package/dist/cjs/createServerFn.d.cts +6 -5
- package/dist/cjs/fileRoute.d.cts +2 -2
- package/dist/cjs/qss.cjs +2 -2
- package/dist/cjs/qss.cjs.map +1 -1
- package/dist/cjs/qss.d.cts +1 -1
- package/dist/cjs/route.cjs +6 -0
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +7 -7
- package/dist/cjs/router.cjs +5 -8
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/awaited.d.ts +3 -2
- package/dist/esm/awaited.js +16 -5
- package/dist/esm/awaited.js.map +1 -1
- package/dist/esm/createServerFn.d.ts +6 -5
- package/dist/esm/createServerFn.js +1 -7
- package/dist/esm/createServerFn.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +2 -2
- package/dist/esm/qss.d.ts +1 -1
- package/dist/esm/qss.js +2 -2
- package/dist/esm/qss.js.map +1 -1
- package/dist/esm/route.d.ts +7 -7
- package/dist/esm/route.js +6 -0
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +5 -8
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/awaited.tsx +31 -7
- package/src/createServerFn.ts +20 -47
- package/src/qss.ts +2 -2
- package/src/route.ts +18 -13
- package/src/router.ts +6 -9
package/src/route.ts
CHANGED
|
@@ -213,7 +213,11 @@ export type UpdatableRouteOptions<
|
|
|
213
213
|
onEnter?: (match: AnyRouteMatch) => void
|
|
214
214
|
onStay?: (match: AnyRouteMatch) => void
|
|
215
215
|
onLeave?: (match: AnyRouteMatch) => void
|
|
216
|
-
meta?: (ctx: {
|
|
216
|
+
meta?: (ctx: {
|
|
217
|
+
loaderData: TLoaderData
|
|
218
|
+
}) =>
|
|
219
|
+
| JSX.IntrinsicElements['meta'][]
|
|
220
|
+
| Promise<JSX.IntrinsicElements['meta'][]>
|
|
217
221
|
links?: () => JSX.IntrinsicElements['link'][]
|
|
218
222
|
scripts?: () => JSX.IntrinsicElements['script'][]
|
|
219
223
|
} & UpdatableStaticRouteOption
|
|
@@ -371,11 +375,12 @@ export type MergeFromFromParent<T, U> = IsAny<T, U, T & U>
|
|
|
371
375
|
export type ResolveAllParams<
|
|
372
376
|
TParentRoute extends AnyRoute,
|
|
373
377
|
TParams extends AnyPathParams,
|
|
374
|
-
> =
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
> =
|
|
379
|
+
Record<never, string> extends TParentRoute['types']['allParams']
|
|
380
|
+
? TParams
|
|
381
|
+
: Expand<
|
|
382
|
+
UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}
|
|
383
|
+
>
|
|
379
384
|
|
|
380
385
|
export type RouteConstraints = {
|
|
381
386
|
TParentRoute: AnyRoute
|
|
@@ -516,9 +521,6 @@ export function getRouteApi<
|
|
|
516
521
|
>({ id })
|
|
517
522
|
}
|
|
518
523
|
|
|
519
|
-
/**
|
|
520
|
-
* @deprecated Use the `getRouteApi` function instead.
|
|
521
|
-
*/
|
|
522
524
|
export class RouteApi<
|
|
523
525
|
TId extends RouteIds<RegisteredRouter['routeTree']>,
|
|
524
526
|
TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
|
|
@@ -533,6 +535,9 @@ export class RouteApi<
|
|
|
533
535
|
> {
|
|
534
536
|
id: TId
|
|
535
537
|
|
|
538
|
+
/**
|
|
539
|
+
* @deprecated Use the `getRouteApi` function instead.
|
|
540
|
+
*/
|
|
536
541
|
constructor({ id }: { id: TId }) {
|
|
537
542
|
this.id = id as any
|
|
538
543
|
}
|
|
@@ -1063,15 +1068,12 @@ export function createRootRouteWithContext<TRouterContext extends {}>() {
|
|
|
1063
1068
|
/**
|
|
1064
1069
|
* @deprecated Use the `createRootRouteWithContext` function instead.
|
|
1065
1070
|
*/
|
|
1066
|
-
export const rootRouteWithContext = createRootRouteWithContext
|
|
1071
|
+
export const rootRouteWithContext = createRootRouteWithContext
|
|
1067
1072
|
|
|
1068
1073
|
export type RootSearchSchema = {
|
|
1069
1074
|
__TRootSearchSchema__: '__TRootSearchSchema__'
|
|
1070
1075
|
}
|
|
1071
1076
|
|
|
1072
|
-
/**
|
|
1073
|
-
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
1074
|
-
*/
|
|
1075
1077
|
export class RootRoute<
|
|
1076
1078
|
TSearchSchemaInput extends Record<string, any> = RootSearchSchema,
|
|
1077
1079
|
TSearchSchema extends Record<string, any> = RootSearchSchema,
|
|
@@ -1105,6 +1107,9 @@ export class RootRoute<
|
|
|
1105
1107
|
any, // TChildren
|
|
1106
1108
|
any // TRouteTree
|
|
1107
1109
|
> {
|
|
1110
|
+
/**
|
|
1111
|
+
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
1112
|
+
*/
|
|
1108
1113
|
constructor(
|
|
1109
1114
|
options?: Omit<
|
|
1110
1115
|
RouteOptions<
|
package/src/router.ts
CHANGED
|
@@ -1356,7 +1356,7 @@ export class Router<
|
|
|
1356
1356
|
|
|
1357
1357
|
if ((latestPromise = checkLatest())) return await latestPromise
|
|
1358
1358
|
|
|
1359
|
-
const meta = route.options.meta?.({
|
|
1359
|
+
const meta = await route.options.meta?.({
|
|
1360
1360
|
loaderData,
|
|
1361
1361
|
})
|
|
1362
1362
|
|
|
@@ -1714,14 +1714,11 @@ export class Router<
|
|
|
1714
1714
|
const id = `__TSR_DEHYDRATED__${strKey}`
|
|
1715
1715
|
const data =
|
|
1716
1716
|
typeof getData === 'function' ? await (getData as any)() : getData
|
|
1717
|
-
return `<script id='${id}' suppressHydrationWarning>
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
el.parentElement.removeChild(el)
|
|
1723
|
-
})()
|
|
1724
|
-
</script>`
|
|
1717
|
+
return `<script id='${id}' suppressHydrationWarning>
|
|
1718
|
+
window["__TSR_DEHYDRATED__${escapeJSON(
|
|
1719
|
+
strKey,
|
|
1720
|
+
)}"] = ${JSON.stringify(this.options.transformer.stringify(data))}
|
|
1721
|
+
</script>`
|
|
1725
1722
|
})
|
|
1726
1723
|
|
|
1727
1724
|
return () => this.hydrateData<T>(key)
|