@tanstack/react-router 1.5.2 → 1.5.4

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.
@@ -2485,10 +2485,9 @@
2485
2485
  };
2486
2486
  buildLocation = opts => {
2487
2487
  const build = (dest = {}, matches) => {
2488
- const from = this.latestLocation;
2489
- const fromSearch = (this.state.pendingMatches || this.state.matches).reverse()[0]?.search || from.search;
2490
- let pathname = this.resolvePathWithBase(from.pathname, `${dest.to ?? ''}`);
2491
- const fromMatches = this.matchRoutes(from.pathname, fromSearch);
2488
+ const fromSearch = (this.state.pendingMatches || this.state.matches).reverse()[0]?.search || this.latestLocation.search;
2489
+ let pathname = this.resolvePathWithBase(dest.from ?? this.latestLocation.pathname, `${dest.to ?? ''}`);
2490
+ const fromMatches = this.matchRoutes(this.latestLocation.pathname, fromSearch);
2492
2491
  const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
2493
2492
  const prevParams = {
2494
2493
  ...last(fromMatches)?.params
@@ -2519,10 +2518,10 @@
2519
2518
  const postFilteredSearch = postSearchFilters?.length ? postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
2520
2519
  const search = replaceEqualDeep(fromSearch, postFilteredSearch);
2521
2520
  const searchStr = this.options.stringifySearch(search);
2522
- const hash = dest.hash === true ? from.hash : dest.hash ? functionalUpdate(dest.hash, from.hash) : undefined;
2521
+ const hash = dest.hash === true ? this.latestLocation.hash : dest.hash ? functionalUpdate(dest.hash, this.latestLocation.hash) : undefined;
2523
2522
  const hashStr = hash ? `#${hash}` : '';
2524
- let nextState = dest.state === true ? from.state : dest.state ? functionalUpdate(dest.state, from.state) : from.state;
2525
- nextState = replaceEqualDeep(from.state, nextState);
2523
+ let nextState = dest.state === true ? this.latestLocation.state : dest.state ? functionalUpdate(dest.state, this.latestLocation.state) : this.latestLocation.state;
2524
+ nextState = replaceEqualDeep(this.latestLocation.state, nextState);
2526
2525
  return {
2527
2526
  pathname,
2528
2527
  search,