@tanstack/router-core 1.130.11 → 1.130.17

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.130.11",
3
+ "version": "1.130.17",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -70,7 +70,7 @@
70
70
  "seroval-plugins": "^1.3.2",
71
71
  "tiny-invariant": "^1.3.3",
72
72
  "tiny-warning": "^1.0.3",
73
- "@tanstack/history": "1.129.7"
73
+ "@tanstack/history": "1.130.12"
74
74
  },
75
75
  "devDependencies": {
76
76
  "esbuild": "^0.25.0"
package/src/router.ts CHANGED
@@ -614,8 +614,8 @@ export type InvalidateFn<TRouter extends AnyRouter> = (opts?: {
614
614
  }) => Promise<void>
615
615
 
616
616
  export type ParseLocationFn<TRouteTree extends AnyRoute> = (
617
+ locationToParse: HistoryLocation,
617
618
  previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>,
618
- locationToParse?: HistoryLocation,
619
619
  ) => ParsedLocation<FullSearchSchema<TRouteTree>>
620
620
 
621
621
  export type GetMatchRoutesFn = (
@@ -901,7 +901,7 @@ export class RouterCore<
901
901
  initialEntries: [this.basepath || '/'],
902
902
  })
903
903
  : createBrowserHistory()) as TRouterHistory)
904
- this.latestLocation = this.parseLocation()
904
+ this.updateLatestLocation()
905
905
  }
906
906
 
907
907
  if (this.options.routeTree !== this.routeTree) {
@@ -939,6 +939,13 @@ export class RouterCore<
939
939
  return this.__store.state
940
940
  }
941
941
 
942
+ updateLatestLocation = () => {
943
+ this.latestLocation = this.parseLocation(
944
+ this.history.location,
945
+ this.latestLocation,
946
+ )
947
+ }
948
+
942
949
  buildRouteTree = () => {
943
950
  const { routesById, routesByPath, flatRoutes } = processRouteTree({
944
951
  routeTree: this.routeTree,
@@ -985,8 +992,8 @@ export class RouterCore<
985
992
  }
986
993
 
987
994
  parseLocation: ParseLocationFn<TRouteTree> = (
988
- previousLocation,
989
995
  locationToParse,
996
+ previousLocation,
990
997
  ) => {
991
998
  const parse = ({
992
999
  pathname,
@@ -1007,7 +1014,7 @@ export class RouterCore<
1007
1014
  }
1008
1015
  }
1009
1016
 
1010
- const location = parse(locationToParse ?? this.history.location)
1017
+ const location = parse(locationToParse)
1011
1018
 
1012
1019
  const { __tempLocation, __tempKey } = location.state
1013
1020
 
@@ -1805,7 +1812,7 @@ export class RouterCore<
1805
1812
  beforeLoad = () => {
1806
1813
  // Cancel any pending matches
1807
1814
  this.cancelMatches()
1808
- this.latestLocation = this.parseLocation(this.latestLocation)
1815
+ this.updateLatestLocation()
1809
1816
 
1810
1817
  if (this.isServer) {
1811
1818
  // for SPAs on the initial load, this is handled by the Transitioner