@tanstack/react-router 1.45.4 → 1.45.5

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.
@@ -392,11 +392,10 @@ class Router {
392
392
  this.buildLocation = (opts) => {
393
393
  const build = (dest = {}, matches) => {
394
394
  var _a, _b, _c;
395
- const currentLocation = this.state.isLoading ? this.state.resolvedLocation : this.latestLocation;
396
- const location = dest._fromLocation ?? currentLocation;
397
- let fromPath = location.pathname;
398
- let fromSearch = dest.fromSearch || location.search;
399
- const fromMatches = this.matchRoutes(location.pathname, fromSearch);
395
+ const fromMatches = dest._fromLocation != null ? this.matchRoutes(
396
+ dest._fromLocation.pathname,
397
+ dest.fromSearch || dest._fromLocation.search
398
+ ) : this.state.matches;
400
399
  const fromMatch = dest.from != null ? fromMatches.find(
401
400
  (d) => matchPathname(this.basepath, trimPathRight(d.pathname), {
402
401
  to: dest.from,
@@ -404,12 +403,12 @@ class Router {
404
403
  fuzzy: false
405
404
  })
406
405
  ) : void 0;
407
- fromPath = (fromMatch == null ? void 0 : fromMatch.pathname) || fromPath;
406
+ const fromPath = (fromMatch == null ? void 0 : fromMatch.pathname) || this.latestLocation.pathname;
408
407
  invariant(
409
408
  dest.from == null || fromMatch != null,
410
409
  "Could not find match for from: " + dest.from
411
410
  );
412
- fromSearch = ((_a = last(fromMatches)) == null ? void 0 : _a.search) || this.latestLocation.search;
411
+ const fromSearch = ((_a = last(fromMatches)) == null ? void 0 : _a.search) || this.latestLocation.search;
413
412
  const stayingMatches = matches == null ? void 0 : matches.filter(
414
413
  (d) => fromMatches.find((e) => e.routeId === d.routeId)
415
414
  );