@tanstack/router-core 1.124.0 → 1.124.2
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.
- package/dist/cjs/router.cjs +2 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +2 -1
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +9 -3
package/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -1415,11 +1415,15 @@ export class RouterCore<
|
|
|
1415
1415
|
// By default, start with the current location
|
|
1416
1416
|
let fromPath = lastMatch.fullPath
|
|
1417
1417
|
|
|
1418
|
-
|
|
1419
|
-
|
|
1418
|
+
const routeIsChanging =
|
|
1419
|
+
!!dest.to &&
|
|
1420
|
+
dest.to !== fromPath &&
|
|
1421
|
+
this.resolvePathWithBase(fromPath, `${dest.to}`) !== fromPath
|
|
1422
|
+
|
|
1423
|
+
// If the route is changing we need to find the relative fromPath
|
|
1420
1424
|
if (dest.unsafeRelative === 'path') {
|
|
1421
1425
|
fromPath = currentLocation.pathname
|
|
1422
|
-
} else if (
|
|
1426
|
+
} else if (routeIsChanging && dest.from) {
|
|
1423
1427
|
fromPath = dest.from
|
|
1424
1428
|
const existingFrom = [...allFromMatches].reverse().find((d) => {
|
|
1425
1429
|
return (
|
|
@@ -1708,6 +1712,7 @@ export class RouterCore<
|
|
|
1708
1712
|
}: BuildNextOptions & CommitLocationOptions = {}) => {
|
|
1709
1713
|
if (href) {
|
|
1710
1714
|
const currentIndex = this.history.location.state.__TSR_index
|
|
1715
|
+
|
|
1711
1716
|
const parsed = parseHref(href, {
|
|
1712
1717
|
__TSR_index: replace ? currentIndex : currentIndex + 1,
|
|
1713
1718
|
})
|
|
@@ -1721,6 +1726,7 @@ export class RouterCore<
|
|
|
1721
1726
|
...(rest as any),
|
|
1722
1727
|
_includeValidateSearch: true,
|
|
1723
1728
|
})
|
|
1729
|
+
|
|
1724
1730
|
return this.commitLocation({
|
|
1725
1731
|
...location,
|
|
1726
1732
|
viewTransition,
|