@tanstack/router-core 1.129.3 → 1.129.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.
@@ -233,7 +233,7 @@ class RouterCore {
233
233
  const lastMatch = utils.last(allCurrentLocationMatches);
234
234
  let fromPath = lastMatch.fullPath;
235
235
  const toPath = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
236
- const routeIsChanging = !!dest.to && !this.comparePaths(dest.to.toString(), fromPath) && !this.comparePaths(toPath, fromPath);
236
+ const routeIsChanging = !!dest.to && !comparePaths(dest.to.toString(), fromPath) && !comparePaths(toPath, fromPath);
237
237
  if (dest.unsafeRelative === "path") {
238
238
  fromPath = currentLocation.pathname;
239
239
  } else if (routeIsChanging && dest.from) {
@@ -244,10 +244,10 @@ class RouterCore {
244
244
  void 0
245
245
  ).matchedRoutes;
246
246
  const matchedFrom = [...allCurrentLocationMatches].reverse().find((d) => {
247
- return this.comparePaths(d.fullPath, fromPath);
247
+ return comparePaths(d.fullPath, fromPath);
248
248
  });
249
249
  const matchedCurrent = [...allFromMatches].reverse().find((d) => {
250
- return this.comparePaths(d.fullPath, currentLocation.pathname);
250
+ return comparePaths(d.fullPath, currentLocation.pathname);
251
251
  });
252
252
  if (!matchedFrom && !matchedCurrent) {
253
253
  console.warn(`Could not find match for from: ${fromPath}`);
@@ -1646,14 +1646,15 @@ class RouterCore {
1646
1646
  });
1647
1647
  return matches;
1648
1648
  }
1649
- comparePaths(path1, path2) {
1650
- return path1.replace(/\/$/, "") === path2.replace(/\/$/, "");
1651
- }
1652
1649
  }
1653
1650
  class SearchParamError extends Error {
1654
1651
  }
1655
1652
  class PathParamError extends Error {
1656
1653
  }
1654
+ const normalize = (str) => str.endsWith("/") && str.length > 1 ? str.slice(0, -1) : str;
1655
+ function comparePaths(a, b) {
1656
+ return normalize(a) === normalize(b);
1657
+ }
1657
1658
  function lazyFn(fn, key) {
1658
1659
  return async (...args) => {
1659
1660
  const imported = await fn();