@tanstack/react-router 1.57.17 → 1.57.18

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.
@@ -225,7 +225,7 @@ class Router {
225
225
  };
226
226
  this.buildLocation = (opts) => {
227
227
  const build = (dest = {}, matches) => {
228
- var _a, _b, _c, _d;
228
+ var _a, _b, _c, _d, _e;
229
229
  const fromMatches = dest._fromLocation ? this.matchRoutes(dest._fromLocation) : this.state.matches;
230
230
  const fromMatch = dest.from != null ? fromMatches.find(
231
231
  (d) => path.matchPathname(this.basepath, path.trimPathRight(d.pathname), {
@@ -239,16 +239,16 @@ class Router {
239
239
  dest.from == null || fromMatch != null,
240
240
  "Could not find match for from: " + dest.from
241
241
  );
242
- const fromSearch = this.state.pendingMatches ? (_a = utils.last(this.state.pendingMatches)) == null ? void 0 : _a.search : ((_b = utils.last(fromMatches)) == null ? void 0 : _b.search) || this.latestLocation.search;
242
+ const fromSearch = ((_a = this.state.pendingMatches) == null ? void 0 : _a.length) ? (_b = utils.last(this.state.pendingMatches)) == null ? void 0 : _b.search : ((_c = utils.last(fromMatches)) == null ? void 0 : _c.search) || this.latestLocation.search;
243
243
  const stayingMatches = matches == null ? void 0 : matches.filter(
244
244
  (d) => fromMatches.find((e) => e.routeId === d.routeId)
245
245
  );
246
- const fromRouteByFromPathRouteId = this.routesById[(_c = stayingMatches == null ? void 0 : stayingMatches.find((d) => d.pathname === fromPath)) == null ? void 0 : _c.routeId];
246
+ const fromRouteByFromPathRouteId = this.routesById[(_d = stayingMatches == null ? void 0 : stayingMatches.find((d) => d.pathname === fromPath)) == null ? void 0 : _d.routeId];
247
247
  let pathname = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(
248
248
  fromPath,
249
249
  (fromRouteByFromPathRouteId == null ? void 0 : fromRouteByFromPathRouteId.to) ?? fromPath
250
250
  );
251
- const prevParams = { ...(_d = utils.last(fromMatches)) == null ? void 0 : _d.params };
251
+ const prevParams = { ...(_e = utils.last(fromMatches)) == null ? void 0 : _e.params };
252
252
  let nextParams = (dest.params ?? true) === true ? prevParams : { ...prevParams, ...utils.functionalUpdate(dest.params, prevParams) };
253
253
  if (Object.keys(nextParams).length > 0) {
254
254
  matches == null ? void 0 : matches.map((d) => {