@tanstack/react-router 1.45.4 → 1.45.6

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