@tanstack/router-core 1.131.27 → 1.131.30

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.
@@ -237,30 +237,23 @@ class RouterCore {
237
237
  _buildLocation: true
238
238
  });
239
239
  const lastMatch = utils.last(allCurrentLocationMatches);
240
- let fromPath = this.resolvePathWithBase(lastMatch.fullPath, ".");
241
- const toPath = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
242
- const routeIsChanging = !!dest.to && !comparePaths(dest.to.toString(), fromPath) && !comparePaths(toPath, fromPath);
243
- if (dest.unsafeRelative === "path") {
244
- fromPath = currentLocation.pathname;
245
- } else if (routeIsChanging && dest.from) {
246
- fromPath = dest.from;
247
- if (process.env.NODE_ENV !== "production" && dest._isNavigate) {
248
- const allFromMatches = this.getMatchedRoutes(
249
- dest.from,
250
- void 0
251
- ).matchedRoutes;
252
- const matchedFrom = utils.findLast(allCurrentLocationMatches, (d) => {
253
- return comparePaths(d.fullPath, fromPath);
254
- });
255
- const matchedCurrent = utils.findLast(allFromMatches, (d) => {
256
- return comparePaths(d.fullPath, currentLocation.pathname);
257
- });
258
- if (!matchedFrom && !matchedCurrent) {
259
- console.warn(`Could not find match for from: ${fromPath}`);
260
- }
240
+ if (dest.from && process.env.NODE_ENV !== "production" && dest._isNavigate) {
241
+ const allFromMatches = this.getMatchedRoutes(
242
+ dest.from,
243
+ void 0
244
+ ).matchedRoutes;
245
+ const matchedFrom = utils.findLast(allCurrentLocationMatches, (d) => {
246
+ return comparePaths(d.fullPath, dest.from);
247
+ });
248
+ const matchedCurrent = utils.findLast(allFromMatches, (d) => {
249
+ return comparePaths(d.fullPath, lastMatch.fullPath);
250
+ });
251
+ if (!matchedFrom && !matchedCurrent) {
252
+ console.warn(`Could not find match for from: ${dest.from}`);
261
253
  }
262
254
  }
263
- fromPath = this.resolvePathWithBase(fromPath, ".");
255
+ const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lastMatch.fullPath;
256
+ const fromPath = this.resolvePathWithBase(defaultedFromPath, ".");
264
257
  const fromSearch = lastMatch.search;
265
258
  const fromParams = { ...lastMatch.params };
266
259
  const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");