@tanstack/react-router 1.61.1 → 1.62.1
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/route.cjs +4 -0
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +3 -0
- package/dist/cjs/router.cjs +10 -3
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +1 -0
- package/dist/esm/route.d.ts +3 -0
- package/dist/esm/route.js +4 -0
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +1 -0
- package/dist/esm/router.js +10 -3
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/route.ts +7 -1
- package/src/router.ts +11 -2
package/package.json
CHANGED
package/src/route.ts
CHANGED
|
@@ -882,6 +882,7 @@ export class Route<
|
|
|
882
882
|
private _path!: TPath
|
|
883
883
|
private _fullPath!: TFullPath
|
|
884
884
|
private _to!: TrimPathRight<TFullPath>
|
|
885
|
+
private _ssr!: boolean
|
|
885
886
|
|
|
886
887
|
public get to() {
|
|
887
888
|
/* invariant(
|
|
@@ -916,6 +917,10 @@ export class Route<
|
|
|
916
917
|
return this._fullPath
|
|
917
918
|
}
|
|
918
919
|
|
|
920
|
+
public get ssr() {
|
|
921
|
+
return this._ssr
|
|
922
|
+
}
|
|
923
|
+
|
|
919
924
|
// Optional
|
|
920
925
|
children?: TChildren
|
|
921
926
|
originalIndex?: number
|
|
@@ -984,7 +989,7 @@ export class Route<
|
|
|
984
989
|
loaderDeps: TLoaderDeps
|
|
985
990
|
}
|
|
986
991
|
|
|
987
|
-
init = (opts: { originalIndex: number }): void => {
|
|
992
|
+
init = (opts: { originalIndex: number; defaultSsr?: boolean }): void => {
|
|
988
993
|
this.originalIndex = opts.originalIndex
|
|
989
994
|
|
|
990
995
|
const options = this.options as
|
|
@@ -1051,6 +1056,7 @@ export class Route<
|
|
|
1051
1056
|
// this.customId = customId as TCustomId
|
|
1052
1057
|
this._fullPath = fullPath as TFullPath
|
|
1053
1058
|
this._to = fullPath as TrimPathRight<TFullPath>
|
|
1059
|
+
this._ssr = options?.ssr ?? opts.defaultSsr ?? true
|
|
1054
1060
|
}
|
|
1055
1061
|
|
|
1056
1062
|
addChildren<
|
package/src/router.ts
CHANGED
|
@@ -451,6 +451,8 @@ export interface RouterOptions<
|
|
|
451
451
|
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver property)
|
|
452
452
|
*/
|
|
453
453
|
isServer?: boolean
|
|
454
|
+
|
|
455
|
+
defaultSsr?: boolean
|
|
454
456
|
}
|
|
455
457
|
|
|
456
458
|
export interface RouterErrorSerializer<TSerializedError> {
|
|
@@ -773,13 +775,19 @@ export class Router<
|
|
|
773
775
|
|
|
774
776
|
const notFoundRoute = this.options.notFoundRoute
|
|
775
777
|
if (notFoundRoute) {
|
|
776
|
-
notFoundRoute.init({
|
|
778
|
+
notFoundRoute.init({
|
|
779
|
+
originalIndex: 99999999999,
|
|
780
|
+
defaultSsr: this.options.defaultSsr,
|
|
781
|
+
})
|
|
777
782
|
;(this.routesById as any)[notFoundRoute.id] = notFoundRoute
|
|
778
783
|
}
|
|
779
784
|
|
|
780
785
|
const recurseRoutes = (childRoutes: Array<AnyRoute>) => {
|
|
781
786
|
childRoutes.forEach((childRoute, i) => {
|
|
782
|
-
childRoute.init({
|
|
787
|
+
childRoute.init({
|
|
788
|
+
originalIndex: i,
|
|
789
|
+
defaultSsr: this.options.defaultSsr,
|
|
790
|
+
})
|
|
783
791
|
|
|
784
792
|
const existingRoute = (this.routesById as any)[childRoute.id]
|
|
785
793
|
|
|
@@ -2386,6 +2394,7 @@ export class Router<
|
|
|
2386
2394
|
...prev,
|
|
2387
2395
|
isFetching: loaderRunningAsync ? prev.isFetching : false,
|
|
2388
2396
|
loaderPromise: undefined,
|
|
2397
|
+
invalid: false,
|
|
2389
2398
|
}))
|
|
2390
2399
|
})(),
|
|
2391
2400
|
)
|