@tanstack/react-router 1.5.1 → 1.5.3
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/build/cjs/router.js +6 -7
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +6 -7
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +353 -353
- package/build/umd/index.development.js +6 -7
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/router.ts +16 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tanstack/store": "^0.1.3",
|
|
45
45
|
"tiny-invariant": "^1.3.1",
|
|
46
46
|
"tiny-warning": "^1.0.3",
|
|
47
|
-
"@tanstack/history": "1.5.
|
|
47
|
+
"@tanstack/history": "1.5.3"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/router.ts
CHANGED
|
@@ -708,13 +708,19 @@ export class Router<
|
|
|
708
708
|
} = {},
|
|
709
709
|
matches?: AnyRouteMatch[],
|
|
710
710
|
): ParsedLocation => {
|
|
711
|
-
const from = this.latestLocation
|
|
712
711
|
const fromSearch =
|
|
713
712
|
(this.state.pendingMatches || this.state.matches).reverse()[0]
|
|
714
|
-
?.search ||
|
|
715
|
-
let pathname = this.resolvePathWithBase(from.pathname, `${dest.to ?? ''}`)
|
|
713
|
+
?.search || this.latestLocation.search
|
|
716
714
|
|
|
717
|
-
|
|
715
|
+
let pathname = this.resolvePathWithBase(
|
|
716
|
+
dest.from ?? this.latestLocation.pathname,
|
|
717
|
+
`${dest.to ?? ''}`,
|
|
718
|
+
)
|
|
719
|
+
|
|
720
|
+
const fromMatches = this.matchRoutes(
|
|
721
|
+
this.latestLocation.pathname,
|
|
722
|
+
fromSearch,
|
|
723
|
+
)
|
|
718
724
|
const stayingMatches = matches?.filter(
|
|
719
725
|
(d) => fromMatches?.find((e) => e.routeId === d.routeId),
|
|
720
726
|
)
|
|
@@ -786,21 +792,21 @@ export class Router<
|
|
|
786
792
|
|
|
787
793
|
const hash =
|
|
788
794
|
dest.hash === true
|
|
789
|
-
?
|
|
795
|
+
? this.latestLocation.hash
|
|
790
796
|
: dest.hash
|
|
791
|
-
? functionalUpdate(dest.hash!,
|
|
797
|
+
? functionalUpdate(dest.hash!, this.latestLocation.hash)
|
|
792
798
|
: undefined
|
|
793
799
|
|
|
794
800
|
const hashStr = hash ? `#${hash}` : ''
|
|
795
801
|
|
|
796
802
|
let nextState =
|
|
797
803
|
dest.state === true
|
|
798
|
-
?
|
|
804
|
+
? this.latestLocation.state
|
|
799
805
|
: dest.state
|
|
800
|
-
? functionalUpdate(dest.state,
|
|
801
|
-
:
|
|
806
|
+
? functionalUpdate(dest.state, this.latestLocation.state)
|
|
807
|
+
: this.latestLocation.state
|
|
802
808
|
|
|
803
|
-
nextState = replaceEqualDeep(
|
|
809
|
+
nextState = replaceEqualDeep(this.latestLocation.state, nextState)
|
|
804
810
|
|
|
805
811
|
return {
|
|
806
812
|
pathname,
|