@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.61.1",
3
+ "version": "1.62.1",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
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({ originalIndex: 99999999999 })
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({ originalIndex: i })
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
  )