@tanstack/router-core 1.125.3 → 1.125.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.
@@ -236,16 +236,17 @@ class RouterCore {
236
236
  });
237
237
  const lastMatch = utils.last(allFromMatches);
238
238
  let fromPath = lastMatch.fullPath;
239
- const routeIsChanging = !!dest.to && dest.to !== fromPath && this.resolvePathWithBase(fromPath, `${dest.to}`) !== fromPath;
239
+ const toPath = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
240
+ const routeIsChanging = !!dest.to && !this.comparePaths(dest.to.toString(), fromPath) && !this.comparePaths(toPath, fromPath);
240
241
  if (dest.unsafeRelative === "path") {
241
242
  fromPath = currentLocation.pathname;
242
243
  } else if (routeIsChanging && dest.from) {
243
244
  fromPath = dest.from;
244
245
  const existingFrom = [...allFromMatches].reverse().find((d) => {
245
- return d.fullPath === fromPath || d.fullPath === path.joinPaths([fromPath, "/"]);
246
+ return this.comparePaths(d.fullPath, fromPath);
246
247
  });
247
248
  if (!existingFrom) {
248
- console.warn(`Could not find match for from: ${dest.from}`);
249
+ console.warn(`Could not find match for from: ${fromPath}`);
249
250
  }
250
251
  }
251
252
  const fromSearch = lastMatch.search;
@@ -1670,6 +1671,9 @@ class RouterCore {
1670
1671
  });
1671
1672
  return matches;
1672
1673
  }
1674
+ comparePaths(path1, path2) {
1675
+ return path1.replace(/(.+)\/$/, "$1") === path2.replace(/(.+)\/$/, "$1");
1676
+ }
1673
1677
  }
1674
1678
  class SearchParamError extends Error {
1675
1679
  }