@tanstack/router-core 1.130.12 → 1.131.2

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.
@@ -79,7 +79,7 @@ class RouterCore {
79
79
  this.history = this.options.history ?? (this.isServer ? history.createMemoryHistory({
80
80
  initialEntries: [this.basepath || "/"]
81
81
  }) : history.createBrowserHistory());
82
- this.latestLocation = this.parseLocation();
82
+ this.updateLatestLocation();
83
83
  }
84
84
  if (this.options.routeTree !== this.routeTree) {
85
85
  this.routeTree = this.options.routeTree;
@@ -104,6 +104,12 @@ class RouterCore {
104
104
  );
105
105
  }
106
106
  };
107
+ this.updateLatestLocation = () => {
108
+ this.latestLocation = this.parseLocation(
109
+ this.history.location,
110
+ this.latestLocation
111
+ );
112
+ };
107
113
  this.buildRouteTree = () => {
108
114
  const { routesById, routesByPath, flatRoutes } = processRouteTree({
109
115
  routeTree: this.routeTree,
@@ -141,7 +147,7 @@ class RouterCore {
141
147
  }
142
148
  });
143
149
  };
144
- this.parseLocation = (previousLocation, locationToParse) => {
150
+ this.parseLocation = (locationToParse, previousLocation) => {
145
151
  const parse = ({
146
152
  pathname,
147
153
  search,
@@ -159,7 +165,7 @@ class RouterCore {
159
165
  state: utils.replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.state, state)
160
166
  };
161
167
  };
162
- const location = parse(locationToParse ?? this.history.location);
168
+ const location = parse(locationToParse);
163
169
  const { __tempLocation, __tempKey } = location.state;
164
170
  if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
165
171
  const parsedTempLocation = parse(__tempLocation);
@@ -512,7 +518,7 @@ class RouterCore {
512
518
  };
513
519
  this.beforeLoad = () => {
514
520
  this.cancelMatches();
515
- this.latestLocation = this.parseLocation(this.latestLocation);
521
+ this.updateLatestLocation();
516
522
  if (this.isServer) {
517
523
  const nextLocation = this.buildLocation({
518
524
  to: this.latestLocation.pathname,