@tanstack/router-core 1.131.27 → 1.131.28

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